redzip 3.0.0 → 3.0.2
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 +18 -0
- package/README.md +5 -3
- package/lib/local/index.js +3 -3
- package/lib/zip/read/index.js +2 -4
- package/lib/zip/read-stat/index.js +2 -4
- package/lib/zip/write/index.js +1 -2
- package/package.json +11 -11
package/ChangeLog
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
2024.03.18, v3.0.2
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 356e6b6 redzip: trammel v6.0.0
|
|
5
|
+
- 71c82c0 redzip: madrun v10.0.1
|
|
6
|
+
- 3962b3a redzip: drop support of node < 18
|
|
7
|
+
- ce55ca2 redzip: supertape v10.4.0
|
|
8
|
+
- 5f558a7 redzip: putout v35.7.5
|
|
9
|
+
- 47b77d7 redzip: eslint-plugin-putout v22.4.1
|
|
10
|
+
- d37ab44 redzip: c8 v9.1.0
|
|
11
|
+
- 512855e redzip: pullout v5.0.1
|
|
12
|
+
- 3bd967e redzip: yauzl v3.1.2
|
|
13
|
+
|
|
14
|
+
2023.08.10, v3.0.1
|
|
15
|
+
|
|
16
|
+
feature:
|
|
17
|
+
- 9fca27c package: readzip v2.0.0
|
|
18
|
+
|
|
1
19
|
2023.08.09, v3.0.0
|
|
2
20
|
|
|
3
21
|
feature:
|
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ const dirStream = await redzip.read(dirPath, {
|
|
|
46
46
|
sort,
|
|
47
47
|
order,
|
|
48
48
|
});
|
|
49
|
+
|
|
49
50
|
console.log(dirStream.type);
|
|
50
51
|
// outputs
|
|
51
52
|
'directory';
|
|
@@ -120,7 +121,7 @@ fileStream.pipe(process.stdout);
|
|
|
120
121
|
// outputs
|
|
121
122
|
'10kb';
|
|
122
123
|
|
|
123
|
-
fileStream.contentLength
|
|
124
|
+
fileStream.contentLength; // 4
|
|
124
125
|
```
|
|
125
126
|
|
|
126
127
|
### readStat(path[, options])
|
|
@@ -154,7 +155,7 @@ When you need to save `string`, or `Buffer` use [Readable.from](https://nodejs.o
|
|
|
154
155
|
#### Example
|
|
155
156
|
|
|
156
157
|
```js
|
|
157
|
-
import {Readable} from 'stream';
|
|
158
|
+
import {Readable} from 'node:stream';
|
|
158
159
|
import {write} from 'redzip';
|
|
159
160
|
import pullout from 'pullout';
|
|
160
161
|
|
|
@@ -174,11 +175,12 @@ await pullout(await read(path));
|
|
|
174
175
|
// returns
|
|
175
176
|
'hello';
|
|
176
177
|
|
|
177
|
-
import {createGzip} from 'zlib';
|
|
178
|
+
import {createGzip} from 'node:zlib';
|
|
178
179
|
|
|
179
180
|
const zipStream = Readable
|
|
180
181
|
.from('hello')
|
|
181
182
|
.pipe(createGzip());
|
|
183
|
+
|
|
182
184
|
await write(path, zipStream, {
|
|
183
185
|
unzip: true,
|
|
184
186
|
});
|
package/lib/local/index.js
CHANGED
|
@@ -67,9 +67,8 @@ module.exports.remove = async (outerPath) => {
|
|
|
67
67
|
if (!error)
|
|
68
68
|
return;
|
|
69
69
|
|
|
70
|
-
if (notDir(error) || winNotDir(error))
|
|
70
|
+
if (notDir(error) || winNotDir(error))
|
|
71
71
|
return await unlink(outerPath);
|
|
72
|
-
}
|
|
73
72
|
|
|
74
73
|
throw error;
|
|
75
74
|
};
|
|
@@ -157,7 +156,8 @@ async function* walk(dir) {
|
|
|
157
156
|
if (dirent.isDirectory()) {
|
|
158
157
|
yield path;
|
|
159
158
|
yield* await walk(path);
|
|
160
|
-
} else
|
|
159
|
+
} else {
|
|
161
160
|
yield path;
|
|
161
|
+
}
|
|
162
162
|
}
|
|
163
163
|
}
|
package/lib/zip/read/index.js
CHANGED
|
@@ -47,9 +47,8 @@ module.exports = async (outerPath, innerPath, options = {}) => {
|
|
|
47
47
|
path.stop();
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (path.isDirectory(inner))
|
|
50
|
+
if (path.isDirectory(inner))
|
|
51
51
|
found = true;
|
|
52
|
-
}
|
|
53
52
|
|
|
54
53
|
if (directory === inner) {
|
|
55
54
|
const type = path.isDirectory() ? 'directory' : 'file';
|
|
@@ -65,9 +64,8 @@ module.exports = async (outerPath, innerPath, options = {}) => {
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
if (!found)
|
|
67
|
+
if (!found)
|
|
69
68
|
throw createError(innerPath);
|
|
70
|
-
}
|
|
71
69
|
|
|
72
70
|
if (stream)
|
|
73
71
|
return stream;
|
|
@@ -13,7 +13,7 @@ module.exports = async (outerPath, innerPath) => {
|
|
|
13
13
|
mode,
|
|
14
14
|
} = path;
|
|
15
15
|
|
|
16
|
-
if (path.isFile(innerPath))
|
|
16
|
+
if (path.isFile(innerPath))
|
|
17
17
|
return {
|
|
18
18
|
type: 'file',
|
|
19
19
|
name,
|
|
@@ -22,9 +22,8 @@ module.exports = async (outerPath, innerPath) => {
|
|
|
22
22
|
owner: 0,
|
|
23
23
|
mode,
|
|
24
24
|
};
|
|
25
|
-
}
|
|
26
25
|
|
|
27
|
-
if (path.isDirectory(innerPath))
|
|
26
|
+
if (path.isDirectory(innerPath))
|
|
28
27
|
return {
|
|
29
28
|
type: 'dir',
|
|
30
29
|
name,
|
|
@@ -33,7 +32,6 @@ module.exports = async (outerPath, innerPath) => {
|
|
|
33
32
|
owner: 0,
|
|
34
33
|
mode,
|
|
35
34
|
};
|
|
36
|
-
}
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
const error = Error(`ENOENT: no such file or directory, stat '${outerPath}${innerPath}'`);
|
package/lib/zip/write/index.js
CHANGED
|
@@ -72,9 +72,8 @@ async function update(outerPath, innerPath, stream, zipfile, {remove}) {
|
|
|
72
72
|
const {entry} = path;
|
|
73
73
|
++count;
|
|
74
74
|
|
|
75
|
-
if (path.isFile(innerPath) || path.isDirectory(innerPath))
|
|
75
|
+
if (path.isFile(innerPath) || path.isDirectory(innerPath))
|
|
76
76
|
continue;
|
|
77
|
-
}
|
|
78
77
|
|
|
79
78
|
if (path.isFile()) {
|
|
80
79
|
stream = await path.openReadStream();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redzip",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "lib/redzip.js",
|
|
6
6
|
"description": "work with files inside archives like with regular files",
|
|
@@ -30,30 +30,30 @@
|
|
|
30
30
|
"once": "^1.4.0",
|
|
31
31
|
"pipe-io": "^4.0.1",
|
|
32
32
|
"readify": "^9.0.0",
|
|
33
|
-
"readzip": "^
|
|
33
|
+
"readzip": "^2.0.0",
|
|
34
34
|
"totalist": "^3.0.1",
|
|
35
|
-
"trammel": "^
|
|
35
|
+
"trammel": "^6.0.0",
|
|
36
36
|
"try-to-catch": "^3.0.0",
|
|
37
37
|
"wraptile": "^3.0.0",
|
|
38
|
-
"yauzl": "^
|
|
38
|
+
"yauzl": "^3.1.2",
|
|
39
39
|
"yazl": "^2.5.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@babel/core": "^7.12.10",
|
|
43
43
|
"@babel/eslint-parser": "^7.12.1",
|
|
44
44
|
"@iocmd/wait": "^2.1.0",
|
|
45
|
-
"c8": "^
|
|
45
|
+
"c8": "^9.1.0",
|
|
46
46
|
"eslint": "^8.4.1",
|
|
47
47
|
"eslint-plugin-n": "^16.0.1",
|
|
48
|
-
"eslint-plugin-putout": "^
|
|
49
|
-
"madrun": "^
|
|
48
|
+
"eslint-plugin-putout": "^22.4.1",
|
|
49
|
+
"madrun": "^10.0.1",
|
|
50
50
|
"memfs": "^4.2.1",
|
|
51
51
|
"mock-fs": "^5.0.0",
|
|
52
52
|
"mock-require": "^3.0.1",
|
|
53
53
|
"nodemon": "^3.0.1",
|
|
54
|
-
"pullout": "^
|
|
55
|
-
"putout": "^
|
|
56
|
-
"supertape": "^
|
|
54
|
+
"pullout": "^5.0.1",
|
|
55
|
+
"putout": "^35.7.5",
|
|
56
|
+
"supertape": "^10.4.0"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
59
59
|
"directory",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"zip"
|
|
66
66
|
],
|
|
67
67
|
"engines": {
|
|
68
|
-
"node": ">=
|
|
68
|
+
"node": ">=18"
|
|
69
69
|
},
|
|
70
70
|
"license": "MIT"
|
|
71
71
|
}
|