@ezs/basics 1.22.1 → 1.22.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.22.3](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.22.2...@ezs/basics@1.22.3) (2022-09-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * 🐛 locations like [files] ([42fb184](https://github.com/Inist-CNRS/ezs/commit/42fb184bba3534bf2123a12d276d89f6809d09a7))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.22.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.22.1...@ezs/basics@1.22.2) (2022-09-14)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * 🐛 feed.flow return a Promise ([e73f140](https://github.com/Inist-CNRS/ezs/commit/e73f14042eb60b464c9e021345e479d24ba0ec81))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [1.22.1](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.22.0...@ezs/basics@1.22.1) (2022-09-07)
7
29
 
8
30
 
package/lib/file-load.js CHANGED
@@ -46,7 +46,7 @@ var _os = require("os");
46
46
  * @param {Boolean} [compress=false] Enable gzip compression
47
47
  * @returns {Object}
48
48
  */
49
- function FILELoad(data, feed) {
49
+ async function FILELoad(data, feed) {
50
50
  if (this.isLast()) {
51
51
  feed.close();
52
52
  return;
@@ -54,9 +54,8 @@ function FILELoad(data, feed) {
54
54
 
55
55
  const cwd = process.cwd();
56
56
  const tpd = (0, _os.tmpdir)();
57
- const location = this.getParam('location', tpd);
58
57
  const compress = this.getParam('compress', false);
59
- const locations = [cwd, tpd, location];
58
+ const locations = this.ezs.getPath().concat(cwd, tpd, this.getParam('location'));
60
59
  const file = locations.filter(Boolean).map(dir => (0, _path.resolve)(dir, String(data).trim())).filter(fil => (0, _fs.existsSync)(fil)).shift();
61
60
 
62
61
  if (!file) {
@@ -64,10 +63,7 @@ function FILELoad(data, feed) {
64
63
  return;
65
64
  }
66
65
 
67
- if (compress) {
68
- feed.flow((0, _fs.createReadStream)(file).pipe((0, _zlib.createGunzip)()));
69
- return;
70
- }
71
-
72
- feed.flow((0, _fs.createReadStream)(file));
66
+ const stream = compress ? (0, _fs.createReadStream)(file).pipe((0, _zlib.createGunzip)()) : (0, _fs.createReadStream)(file);
67
+ await feed.flow(stream);
68
+ return;
73
69
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ezs/basics",
3
3
  "description": "Basics statements for EZS",
4
- "version": "1.22.1",
4
+ "version": "1.22.3",
5
5
  "author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
6
6
  "bugs": "https://github.com/Inist-CNRS/ezs/issues",
7
7
  "dependencies": {
@@ -36,7 +36,7 @@
36
36
  "directories": {
37
37
  "test": "test"
38
38
  },
39
- "gitHead": "ec76c69ceefbb96d50a208cba0a1b3cc9d40c3d1",
39
+ "gitHead": "7fa485938639c0821968dc60de66d248e15a9cdf",
40
40
  "homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
41
41
  "keywords": [
42
42
  "ezs"