@ezs/basics 2.10.0 → 2.10.1

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/README.md CHANGED
@@ -327,7 +327,7 @@ Output:
327
327
  #### Parameters
328
328
 
329
329
  * `location` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Directory location (optional, default `TMPDIR`)
330
- * `identifier` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** File name
330
+ * `identifier` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** File name (if not set, it will be generated automatically)
331
331
  * `content` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Content to save instead of using input object
332
332
  * `jsonl` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Save as json line (optional, default `false`)
333
333
  * `compress` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Enable gzip compression (optional, default `false`)
package/lib/file-save.js CHANGED
@@ -12,6 +12,7 @@ var _pathExists = _interopRequireDefault(require("path-exists"));
12
12
  var _makeDir = _interopRequireDefault(require("make-dir"));
13
13
  var _streamWrite = _interopRequireDefault(require("stream-write"));
14
14
  var _debug = _interopRequireDefault(require("debug"));
15
+ var _uuidRandom = _interopRequireDefault(require("uuid-random"));
15
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
17
  const eol = '\n';
17
18
  const toJSONL = line => JSON.stringify(line).concat(eol);
@@ -46,7 +47,7 @@ const toJSONL = line => JSON.stringify(line).concat(eol);
46
47
  *
47
48
  * @name FILESave
48
49
  * @param {String} [location=TMPDIR] Directory location
49
- * @param {String} [identifier] File name
50
+ * @param {String} [identifier] File name (if not set, it will be generated automatically)
50
51
  * @param {String} [content] Content to save instead of using input object
51
52
  * @param {Boolean} [jsonl=false] Save as json line
52
53
  * @param {Boolean} [compress=false] Enable gzip compression
@@ -55,7 +56,7 @@ const toJSONL = line => JSON.stringify(line).concat(eol);
55
56
  */
56
57
  function FILESave(data, feed) {
57
58
  if (this.isFirst()) {
58
- const identifier = String(this.getParam('identifier'));
59
+ const identifier = String(this.getParam('identifier', (0, _uuidRandom.default)()));
59
60
  const location = _path.default.normalize(this.getParam('location', (0, _os.tmpdir)()));
60
61
  const compress = this.getParam('compress', false);
61
62
  const flags = Boolean(this.getParam('append', false)) ? 'a' : 'w';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ezs/basics",
3
3
  "description": "Basics statements for EZS",
4
- "version": "2.10.0",
4
+ "version": "2.10.1",
5
5
  "author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
6
6
  "bugs": "https://github.com/Inist-CNRS/ezs/issues",
7
7
  "dependencies": {
@@ -26,6 +26,7 @@
26
26
  "tar-stream": "3.1.6",
27
27
  "tmp-filepath": "2.0.0",
28
28
  "unzipper": "0.10.11",
29
+ "uuid-random": "1.3.2",
29
30
  "xml-mapping": "1.7.2",
30
31
  "xml-splitter": "1.2.1"
31
32
  },
@@ -35,7 +36,7 @@
35
36
  "directories": {
36
37
  "test": "test"
37
38
  },
38
- "gitHead": "ef4ce5900d8256359040ab5a839f8768dbd4b8c3",
39
+ "gitHead": "f44fd79c0bce656a8ae1453ba36b7470a448c1b2",
39
40
  "homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
40
41
  "keywords": [
41
42
  "ezs"