@engine9-io/input-tools 1.6.4 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/file/tools.js CHANGED
@@ -64,6 +64,14 @@ async function getTempFilename(options) {
64
64
  return p;
65
65
  }
66
66
 
67
+ async function writeTempFile(options) {
68
+ const { content, postfix = '.txt' } = options;
69
+ const filename = await getTempFilename({ ...options, postfix });
70
+
71
+ await fsp.writeFile(filename, content);
72
+ return { filename };
73
+ }
74
+
67
75
  const {
68
76
  S3Client,
69
77
  HeadObjectCommand,
@@ -256,4 +264,5 @@ module.exports = {
256
264
  getStringArray,
257
265
  makeStrings,
258
266
  streamPacket,
267
+ writeTempFile,
259
268
  };
package/index.js CHANGED
@@ -27,6 +27,7 @@ const {
27
27
  getDebatchTransform,
28
28
  getStringArray,
29
29
  makeStrings,
30
+ writeTempFile,
30
31
  } = require('./file/tools');
31
32
 
32
33
  const ForEachEntry = require('./ForEachEntry');
@@ -47,6 +48,8 @@ handlebars.registerHelper('date', (d, f) => {
47
48
  });
48
49
  handlebars.registerHelper('json', (d) => JSON.stringify(d));
49
50
 
51
+ handlebars.registerHelper('uuid', () => uuidv7());
52
+
50
53
  handlebars.registerHelper('percent', (a, b) => `${((100 * a) / b).toFixed(2)}%`);
51
54
 
52
55
  handlebars.registerHelper('or', (a, b, c) => a || b || c);
@@ -397,6 +400,7 @@ module.exports = {
397
400
  relativeDate,
398
401
  streamPacket,
399
402
  TIMELINE_ENTRY_TYPES,
403
+ writeTempFile,
400
404
  uuidIsValid,
401
405
  uuidv4,
402
406
  uuidv5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engine9-io/input-tools",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Tools for dealing with Engine9 inputs",
5
5
  "main": "index.js",
6
6
  "scripts": {