@engine9-io/input-tools 1.6.3 → 1.6.5

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' } = await this.getHTML(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,8 +48,12 @@ 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
 
55
+ handlebars.registerHelper('or', (a, b, c) => a || b || c);
56
+
52
57
  function isValidDate(d) {
53
58
  // we WANT to use isNaN, not the Number.isNaN -- we're checking the date type
54
59
  // eslint-disable-next-line no-restricted-globals
@@ -395,6 +400,7 @@ module.exports = {
395
400
  relativeDate,
396
401
  streamPacket,
397
402
  TIMELINE_ENTRY_TYPES,
403
+ writeTempFile,
398
404
  uuidIsValid,
399
405
  uuidv4,
400
406
  uuidv5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engine9-io/input-tools",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "Tools for dealing with Engine9 inputs",
5
5
  "main": "index.js",
6
6
  "scripts": {