redzip 4.0.0 → 4.1.0
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 +15 -0
- package/README.md +3 -3
- package/lib/local/index.js +14 -2
- package/lib/zip/list/index.js +1 -1
- package/lib/zip/read/index.js +1 -1
- package/lib/zip/read-size/index.js +1 -1
- package/lib/zip/read-stat/index.js +1 -1
- package/lib/zip/write/index.js +7 -3
- package/package.json +7 -7
package/ChangeLog
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
2026.02.21, v4.1.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 7ccfd80 redzip: write: date: add (#457)
|
|
5
|
+
- 72df84a redzip: redlint v6.1.1
|
|
6
|
+
- 5751676 redzip: putout v42.0.12
|
|
7
|
+
- 25589de redzip: madrun v13.0.0
|
|
8
|
+
- 71c2796 redzip: eslint-plugin-putout v31.0.1
|
|
9
|
+
- b3ab64e redzip: eslint v10.0.1
|
|
10
|
+
|
|
11
|
+
2026.02.13, v4.0.1
|
|
12
|
+
|
|
13
|
+
feature:
|
|
14
|
+
- 8747d2e redzip: readzip v3.0.0
|
|
15
|
+
|
|
1
16
|
2026.01.31, v4.0.0
|
|
2
17
|
|
|
3
18
|
feature:
|
package/README.md
CHANGED
|
@@ -32,15 +32,14 @@ npm i redzip
|
|
|
32
32
|
#### Example
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
|
+
import * as redzip from 'redzip';
|
|
36
|
+
|
|
35
37
|
const sort = 'size';
|
|
36
38
|
const order = 'desc';
|
|
37
39
|
const type = 'raw';
|
|
38
|
-
|
|
39
40
|
const dirPath = '/home/coderaiser/hello.zip/hello/';
|
|
40
41
|
const path = '/home/coderaiser/hello.zip/hello.txt';
|
|
41
42
|
|
|
42
|
-
import * as redzip from 'redzip';
|
|
43
|
-
|
|
44
43
|
const dirStream = await redzip.read(dirPath, {
|
|
45
44
|
type,
|
|
46
45
|
sort,
|
|
@@ -151,6 +150,7 @@ When you need to save `string`, or `Buffer` use [Readable.from](https://nodejs.o
|
|
|
151
150
|
- **options** - `object` can contain:
|
|
152
151
|
- `unzip` - unzip file content before writing
|
|
153
152
|
- `mode` - set permissions mode (optional)
|
|
153
|
+
- `date` - date of modication
|
|
154
154
|
|
|
155
155
|
#### Example
|
|
156
156
|
|
package/lib/local/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
unlink as _unlink,
|
|
16
16
|
lstat,
|
|
17
17
|
opendir,
|
|
18
|
+
utimes,
|
|
18
19
|
} from 'node:fs/promises';
|
|
19
20
|
import readify from 'readify';
|
|
20
21
|
import trammel from 'trammel';
|
|
@@ -27,7 +28,11 @@ const winNotDir = (e) => e?.code === 'ENOENT';
|
|
|
27
28
|
const {assign} = Object;
|
|
28
29
|
|
|
29
30
|
export const write = async (outerPath, innerPath, readStream, options = {}) => {
|
|
30
|
-
const {
|
|
31
|
+
const {
|
|
32
|
+
unzip,
|
|
33
|
+
mode,
|
|
34
|
+
date,
|
|
35
|
+
} = options;
|
|
31
36
|
|
|
32
37
|
if (!readStream) {
|
|
33
38
|
await mkdir(outerPath, {
|
|
@@ -49,6 +54,9 @@ export const write = async (outerPath, innerPath, readStream, options = {}) => {
|
|
|
49
54
|
return await pipe([readStream, createGunzip(), writeStream]);
|
|
50
55
|
|
|
51
56
|
await pipe([readStream, writeStream]);
|
|
57
|
+
|
|
58
|
+
if (date)
|
|
59
|
+
await utimes(outerPath, date, date);
|
|
52
60
|
};
|
|
53
61
|
|
|
54
62
|
export const readSize = async (outerPath, innerPath, options) => {
|
|
@@ -56,7 +64,11 @@ export const readSize = async (outerPath, innerPath, options) => {
|
|
|
56
64
|
};
|
|
57
65
|
|
|
58
66
|
export const remove = async (outerPath, overrides = {}) => {
|
|
59
|
-
const {
|
|
67
|
+
const {
|
|
68
|
+
rmdir = _rmdir,
|
|
69
|
+
unlink = _unlink,
|
|
70
|
+
} = overrides;
|
|
71
|
+
|
|
60
72
|
const [error] = await tryToCatch(rmdir, outerPath);
|
|
61
73
|
|
|
62
74
|
if (!error)
|
package/lib/zip/list/index.js
CHANGED
package/lib/zip/read/index.js
CHANGED
package/lib/zip/write/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import yazl from 'yazl';
|
|
11
11
|
import pipe from 'pipe-io';
|
|
12
12
|
import {tryToCatch} from 'try-to-catch';
|
|
13
|
-
import readzip from 'readzip';
|
|
13
|
+
import {readzip} from 'readzip';
|
|
14
14
|
|
|
15
15
|
const {join, dirname} = posix;
|
|
16
16
|
|
|
@@ -25,6 +25,7 @@ const end = promisify((zipfile, fn) => {
|
|
|
25
25
|
|
|
26
26
|
export default async (outerPath, innerPath, stream, options = {}) => {
|
|
27
27
|
const {
|
|
28
|
+
date,
|
|
28
29
|
rename = _rename,
|
|
29
30
|
unzip,
|
|
30
31
|
remove,
|
|
@@ -42,6 +43,7 @@ export default async (outerPath, innerPath, stream, options = {}) => {
|
|
|
42
43
|
|
|
43
44
|
const createArchive = Promise.all([
|
|
44
45
|
update(outerPath, innerPath, readStream, zipfile, {
|
|
46
|
+
date,
|
|
45
47
|
remove,
|
|
46
48
|
}),
|
|
47
49
|
replace(outerPath, tmpName, outputStream, {
|
|
@@ -65,7 +67,7 @@ export default async (outerPath, innerPath, stream, options = {}) => {
|
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
69
|
|
|
68
|
-
async function update(outerPath, innerPath, stream, zipfile, {remove}) {
|
|
70
|
+
async function update(outerPath, innerPath, stream, zipfile, {remove, date}) {
|
|
69
71
|
const shortPath = innerPath.slice(1);
|
|
70
72
|
|
|
71
73
|
if (!remove && stream)
|
|
@@ -85,7 +87,9 @@ async function update(outerPath, innerPath, stream, zipfile, {remove}) {
|
|
|
85
87
|
|
|
86
88
|
if (path.isFile()) {
|
|
87
89
|
stream = await path.openReadStream();
|
|
88
|
-
zipfile.addReadStream(stream, entry.fileName
|
|
90
|
+
zipfile.addReadStream(stream, entry.fileName, {
|
|
91
|
+
mtime: date,
|
|
92
|
+
});
|
|
89
93
|
continue;
|
|
90
94
|
}
|
|
91
95
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redzip",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/redzip.js",
|
|
6
6
|
"description": "work with files inside archives like with regular files",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"once": "^1.4.0",
|
|
31
31
|
"pipe-io": "^4.0.1",
|
|
32
32
|
"readify": "^10.0.0",
|
|
33
|
-
"readzip": "^
|
|
33
|
+
"readzip": "^3.0.0",
|
|
34
34
|
"totalist": "^3.0.1",
|
|
35
35
|
"trammel": "^6.0.0",
|
|
36
36
|
"try-to-catch": "^4.0.4",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@iocmd/wait": "^2.1.0",
|
|
43
43
|
"c8": "^10.1.2",
|
|
44
|
-
"eslint": "^
|
|
45
|
-
"eslint-plugin-putout": "^
|
|
46
|
-
"madrun": "^
|
|
44
|
+
"eslint": "^10.0.1",
|
|
45
|
+
"eslint-plugin-putout": "^31.0.1",
|
|
46
|
+
"madrun": "^13.0.0",
|
|
47
47
|
"memfs": "^4.2.1",
|
|
48
48
|
"mock-fs": "^5.0.0",
|
|
49
49
|
"nodemon": "^3.0.1",
|
|
50
50
|
"pullout": "^5.0.1",
|
|
51
|
-
"putout": "^
|
|
52
|
-
"redlint": "^
|
|
51
|
+
"putout": "^42.0.12",
|
|
52
|
+
"redlint": "^6.1.1",
|
|
53
53
|
"supertape": "^12.2.0"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|