7zip-native 0.0.12 → 0.0.14
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 +1 -0
- package/dist/index.cjs +11 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +12 -2
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/7zip_native.node +0 -0
- package/prebuilds/darwin-x64/7zip_native.node +0 -0
- package/prebuilds/win32-arm64/7z.dll +0 -0
- package/prebuilds/win32-arm64/7zip_native.node +0 -0
- package/prebuilds/win32-x64/7z.dll +0 -0
- package/prebuilds/win32-x64/7zip_native.node +0 -0
package/README.md
CHANGED
|
@@ -90,6 +90,7 @@ Each entry includes:
|
|
|
90
90
|
| --- | --- | --- |
|
|
91
91
|
| `id` | `number` | Stable ID within this opened archive |
|
|
92
92
|
| `path` | `string` | Entry path, using `/` separators |
|
|
93
|
+
| `extractedPath` | `string` | Relative output path after platform-specific filename normalization; Windows-invalid characters are replaced |
|
|
93
94
|
| `size` | `bigint` | Uncompressed size |
|
|
94
95
|
| `compressedSize` | `bigint` | Compressed size |
|
|
95
96
|
| `isDirectory` | `boolean` | Whether the entry is a directory |
|
package/dist/index.cjs
CHANGED
|
@@ -99,6 +99,11 @@ function sanitizeOutputPath(entryPath) {
|
|
|
99
99
|
}
|
|
100
100
|
return entryPath.replace(/\\/g, '/').split('/').map(sanitizeWindowsSegment).join('/');
|
|
101
101
|
}
|
|
102
|
+
function getExtractedPath(entryPath) {
|
|
103
|
+
const normalized = sanitizeOutputPath(entryPath).replace(/\\/g, '/');
|
|
104
|
+
const segments = normalized.split('/').filter(segment => segment !== '' && segment !== '.');
|
|
105
|
+
return segments.join(node_path.sep);
|
|
106
|
+
}
|
|
102
107
|
function assertSafeRelativeArchivePath(entryPath) {
|
|
103
108
|
const normalized = entryPath.replace(/\\/g, '/');
|
|
104
109
|
const segments = normalized.split('/').filter(segment => segment !== '' && segment !== '.');
|
|
@@ -481,7 +486,12 @@ class Archive {
|
|
|
481
486
|
}
|
|
482
487
|
async entries() {
|
|
483
488
|
this.assertOpen();
|
|
484
|
-
this.entriesPromise ??= native.entries(this.handle)
|
|
489
|
+
this.entriesPromise ??= native.entries(this.handle)
|
|
490
|
+
.then(entries => entries.map(entry => ({
|
|
491
|
+
...entry,
|
|
492
|
+
extractedPath: getExtractedPath(entry.path),
|
|
493
|
+
})))
|
|
494
|
+
.catch((cause) => {
|
|
485
495
|
throw new ArchiveError('ERR_ARCHIVE_OPEN', errorMessage(cause), { cause });
|
|
486
496
|
});
|
|
487
497
|
return this.entriesPromise;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { rename, link, rm, lstat, mkdir } from 'node:fs/promises';
|
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
import { availableParallelism } from 'node:os';
|
|
6
|
-
import { dirname, resolve, join, extname,
|
|
6
|
+
import { dirname, resolve, join, extname, sep, relative } from 'node:path';
|
|
7
7
|
import { Readable } from 'node:stream';
|
|
8
8
|
import { pipeline } from 'node:stream/promises';
|
|
9
9
|
|
|
@@ -96,6 +96,11 @@ function sanitizeOutputPath(entryPath) {
|
|
|
96
96
|
}
|
|
97
97
|
return entryPath.replace(/\\/g, '/').split('/').map(sanitizeWindowsSegment).join('/');
|
|
98
98
|
}
|
|
99
|
+
function getExtractedPath(entryPath) {
|
|
100
|
+
const normalized = sanitizeOutputPath(entryPath).replace(/\\/g, '/');
|
|
101
|
+
const segments = normalized.split('/').filter(segment => segment !== '' && segment !== '.');
|
|
102
|
+
return segments.join(sep);
|
|
103
|
+
}
|
|
99
104
|
function assertSafeRelativeArchivePath(entryPath) {
|
|
100
105
|
const normalized = entryPath.replace(/\\/g, '/');
|
|
101
106
|
const segments = normalized.split('/').filter(segment => segment !== '' && segment !== '.');
|
|
@@ -478,7 +483,12 @@ class Archive {
|
|
|
478
483
|
}
|
|
479
484
|
async entries() {
|
|
480
485
|
this.assertOpen();
|
|
481
|
-
this.entriesPromise ??= native.entries(this.handle)
|
|
486
|
+
this.entriesPromise ??= native.entries(this.handle)
|
|
487
|
+
.then(entries => entries.map(entry => ({
|
|
488
|
+
...entry,
|
|
489
|
+
extractedPath: getExtractedPath(entry.path),
|
|
490
|
+
})))
|
|
491
|
+
.catch((cause) => {
|
|
482
492
|
throw new ArchiveError('ERR_ARCHIVE_OPEN', errorMessage(cause), { cause });
|
|
483
493
|
});
|
|
484
494
|
return this.entriesPromise;
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|