@zip.js/zip.js 2.8.1 → 2.8.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/README.md +2 -2
- package/deno.json +1 -1
- package/dist/README.md +5 -1
- package/dist/zip-core.js +2324 -2606
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core.js +31 -537
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-native.js +8251 -0
- package/dist/zip-fs-native.min.js +1 -0
- package/dist/zip-fs.js +2887 -2854
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +5712 -0
- package/dist/zip-legacy.min.js +1 -0
- package/dist/zip-native.js +5750 -0
- package/dist/zip-native.min.js +1 -0
- package/dist/zip-web-worker-native.js +1 -0
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +2884 -2848
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +8243 -0
- package/index-native.js +31 -0
- package/index-native.min.js +1 -0
- package/index.cjs +2887 -2854
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +1 -4
- package/lib/core/codec-worker.js +17 -21
- package/lib/core/configuration.js +2 -3
- package/lib/core/io.js +2 -1
- package/lib/core/streams/aes-crypto-stream.js +2 -4
- package/lib/core/streams/codec-stream.js +2 -1
- package/lib/core/streams/zlib-js/README.md +1 -0
- package/lib/core/streams/zlib-js/zlib-streams.min.js +1 -0
- package/lib/core/streams/{zlib → zlib-wasm}/zlib-streams-loader.js +1 -2
- package/lib/core/streams/{zlib → zlib-wasm}/zlib-streams.js +4 -0
- package/lib/core/{web-worker.js → web-worker-base.js} +7 -12
- package/lib/core/web-worker-inline-native.js +1 -0
- package/lib/core/web-worker-inline-wasm.js +1 -0
- package/lib/core/web-worker-native.js +40 -0
- package/lib/core/web-worker-wasm.js +47 -0
- package/lib/core/zip-fs.js +3 -6
- package/lib/core/zip-reader.js +6 -11
- package/lib/core/zip-writer.js +3 -6
- package/lib/zip-core-base.js +61 -0
- package/lib/zip-core-native.js +30 -0
- package/lib/zip-core-reader.js +46 -0
- package/lib/zip-core-wasm.js +30 -0
- package/lib/zip-core-writer.js +43 -0
- package/lib/zip-core.js +2 -79
- package/lib/zip-fs-core-native.js +30 -0
- package/lib/{zip-fs-core.js → zip-fs-core-wasm.js} +1 -1
- package/lib/{zip-fs.js → zip-fs-native.js} +2 -4
- package/lib/zip-fs-wasm.js +35 -0
- package/lib/{zip.js → zip-legacy.js} +3 -4
- package/lib/zip-module-native.js +39 -0
- package/lib/zip-module-wasm.js +63 -0
- package/lib/zip-native.js +35 -0
- package/lib/zip-wasm.js +35 -0
- package/package.json +64 -11
- package/lib/core/web-worker-inline.js +0 -1
- /package/lib/core/streams/{zlib → zlib-wasm}/README.md +0 -0
- /package/lib/core/streams/{zlib → zlib-wasm}/zlib-streams.wasm +0 -0
package/lib/core/zip-fs.js
CHANGED
|
@@ -429,8 +429,7 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
429
429
|
error.cause = {
|
|
430
430
|
entry
|
|
431
431
|
};
|
|
432
|
-
|
|
433
|
-
} catch (_) {
|
|
432
|
+
} catch {
|
|
434
433
|
// ignored
|
|
435
434
|
}
|
|
436
435
|
throw error;
|
|
@@ -688,8 +687,7 @@ async function initReaders(entry, options) {
|
|
|
688
687
|
error.cause = {
|
|
689
688
|
entry: child
|
|
690
689
|
};
|
|
691
|
-
|
|
692
|
-
} catch (_) {
|
|
690
|
+
} catch {
|
|
693
691
|
// ignored
|
|
694
692
|
}
|
|
695
693
|
throw error;
|
|
@@ -783,8 +781,7 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
783
781
|
entryOffsets.set(name, indexProgress);
|
|
784
782
|
try {
|
|
785
783
|
await options.onprogress(Array.from(entryOffsets.values()).reduce((previousValue, currentValue) => previousValue + currentValue), totalSize);
|
|
786
|
-
|
|
787
|
-
} catch (_) {
|
|
784
|
+
} catch {
|
|
788
785
|
// ignored
|
|
789
786
|
}
|
|
790
787
|
}
|
package/lib/core/zip-reader.js
CHANGED
|
@@ -356,8 +356,7 @@ class ZipReader {
|
|
|
356
356
|
if (onprogress) {
|
|
357
357
|
try {
|
|
358
358
|
await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
|
|
359
|
-
|
|
360
|
-
} catch (_) {
|
|
359
|
+
} catch {
|
|
361
360
|
// ignored
|
|
362
361
|
}
|
|
363
362
|
}
|
|
@@ -536,7 +535,7 @@ class ZipEntry {
|
|
|
536
535
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
537
536
|
signed: getOptionValue(zipEntry, options, OPTION_CHECK_SIGNATURE) && !passThrough,
|
|
538
537
|
passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),
|
|
539
|
-
outputSize: uncompressedSize,
|
|
538
|
+
outputSize: passThrough ? compressedSize : uncompressedSize,
|
|
540
539
|
signature,
|
|
541
540
|
compressed: compressionMethod != 0 && !passThrough,
|
|
542
541
|
encrypted: zipEntry.encrypted && !passThrough,
|
|
@@ -630,8 +629,7 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
630
629
|
});
|
|
631
630
|
offsetExtraField += 4 + size;
|
|
632
631
|
}
|
|
633
|
-
|
|
634
|
-
} catch (_) {
|
|
632
|
+
} catch {
|
|
635
633
|
// ignored
|
|
636
634
|
}
|
|
637
635
|
const compressionMethod = getUint16(dataView, offset + 4);
|
|
@@ -738,8 +736,7 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
738
736
|
}
|
|
739
737
|
offsetExtraField += 4 + attributeSize;
|
|
740
738
|
}
|
|
741
|
-
|
|
742
|
-
} catch (_) {
|
|
739
|
+
} catch {
|
|
743
740
|
// ignored
|
|
744
741
|
}
|
|
745
742
|
try {
|
|
@@ -760,8 +757,7 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
760
757
|
Object.assign(extraFieldNTFS, extraFieldData);
|
|
761
758
|
Object.assign(directory, extraFieldData);
|
|
762
759
|
}
|
|
763
|
-
|
|
764
|
-
} catch (_) {
|
|
760
|
+
} catch {
|
|
765
761
|
// ignored
|
|
766
762
|
}
|
|
767
763
|
}
|
|
@@ -895,8 +891,7 @@ function getDate(timeRaw) {
|
|
|
895
891
|
const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;
|
|
896
892
|
try {
|
|
897
893
|
return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
|
|
898
|
-
|
|
899
|
-
} catch (_) {
|
|
894
|
+
} catch {
|
|
900
895
|
// ignored
|
|
901
896
|
}
|
|
902
897
|
}
|
package/lib/core/zip-writer.js
CHANGED
|
@@ -681,8 +681,7 @@ async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
|
681
681
|
if (error) {
|
|
682
682
|
try {
|
|
683
683
|
error.corruptedEntry = true;
|
|
684
|
-
|
|
685
|
-
} catch (_) {
|
|
684
|
+
} catch {
|
|
686
685
|
// ignored
|
|
687
686
|
}
|
|
688
687
|
}
|
|
@@ -999,8 +998,7 @@ function getHeaderInfo(options) {
|
|
|
999
998
|
setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
|
|
1000
999
|
setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
|
|
1001
1000
|
setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
|
|
1002
|
-
|
|
1003
|
-
} catch (_) {
|
|
1001
|
+
} catch {
|
|
1004
1002
|
rawExtraFieldNTFS = new Uint8Array();
|
|
1005
1003
|
}
|
|
1006
1004
|
} else {
|
|
@@ -1357,8 +1355,7 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
1357
1355
|
if (options.onprogress) {
|
|
1358
1356
|
try {
|
|
1359
1357
|
await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
|
|
1360
|
-
|
|
1361
|
-
} catch (_) {
|
|
1358
|
+
} catch {
|
|
1362
1359
|
// ignored
|
|
1363
1360
|
}
|
|
1364
1361
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { configure } from "./core/configuration.js";
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
configure({ baseURI: import.meta.url });
|
|
33
|
+
} catch {
|
|
34
|
+
// ignored
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export * from "./zip-core-reader.js";
|
|
38
|
+
export * from "./zip-core-writer.js";
|
|
39
|
+
export {
|
|
40
|
+
Reader,
|
|
41
|
+
Writer,
|
|
42
|
+
TextReader,
|
|
43
|
+
TextWriter,
|
|
44
|
+
Data64URIReader,
|
|
45
|
+
Data64URIWriter,
|
|
46
|
+
BlobReader,
|
|
47
|
+
BlobWriter,
|
|
48
|
+
HttpReader,
|
|
49
|
+
HttpRangeReader,
|
|
50
|
+
Uint8ArrayWriter,
|
|
51
|
+
Uint8ArrayReader,
|
|
52
|
+
SplitDataReader,
|
|
53
|
+
SplitDataWriter,
|
|
54
|
+
ERR_HTTP_RANGE
|
|
55
|
+
} from "./core/io.js";
|
|
56
|
+
export {
|
|
57
|
+
getMimeType
|
|
58
|
+
} from "./core/util/default-mime-type.js";
|
|
59
|
+
export {
|
|
60
|
+
configure
|
|
61
|
+
} from "./core/configuration.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export * from "./zip-core-base.js";
|
|
30
|
+
export * from "./zip-module-native.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ZipReader,
|
|
31
|
+
ZipReaderStream,
|
|
32
|
+
ERR_BAD_FORMAT,
|
|
33
|
+
ERR_EOCDR_NOT_FOUND,
|
|
34
|
+
ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
|
|
35
|
+
ERR_CENTRAL_DIRECTORY_NOT_FOUND,
|
|
36
|
+
ERR_LOCAL_FILE_HEADER_NOT_FOUND,
|
|
37
|
+
ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
|
|
38
|
+
ERR_ENCRYPTED,
|
|
39
|
+
ERR_UNSUPPORTED_ENCRYPTION,
|
|
40
|
+
ERR_UNSUPPORTED_COMPRESSION,
|
|
41
|
+
ERR_INVALID_SIGNATURE,
|
|
42
|
+
ERR_INVALID_UNCOMPRESSED_SIZE,
|
|
43
|
+
ERR_INVALID_PASSWORD,
|
|
44
|
+
ERR_SPLIT_ZIP_FILE,
|
|
45
|
+
ERR_OVERLAPPING_ENTRY
|
|
46
|
+
} from "./core/zip-reader.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export * from "./zip-core-base.js";
|
|
30
|
+
export * from "./zip-module-wasm.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ZipWriter,
|
|
31
|
+
ZipWriterStream,
|
|
32
|
+
ERR_DUPLICATED_NAME,
|
|
33
|
+
ERR_INVALID_COMMENT,
|
|
34
|
+
ERR_INVALID_ENTRY_NAME,
|
|
35
|
+
ERR_INVALID_ENTRY_COMMENT,
|
|
36
|
+
ERR_INVALID_VERSION,
|
|
37
|
+
ERR_INVALID_EXTRAFIELD_TYPE,
|
|
38
|
+
ERR_INVALID_EXTRAFIELD_DATA,
|
|
39
|
+
ERR_INVALID_ENCRYPTION_STRENGTH,
|
|
40
|
+
ERR_UNSUPPORTED_FORMAT,
|
|
41
|
+
ERR_UNDEFINED_UNCOMPRESSED_SIZE,
|
|
42
|
+
ERR_ZIP_NOT_EMPTY
|
|
43
|
+
} from "./core/zip-writer.js";
|
package/lib/zip-core.js
CHANGED
|
@@ -26,82 +26,5 @@
|
|
|
26
26
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let baseURI;
|
|
33
|
-
try {
|
|
34
|
-
baseURI = import.meta.url;
|
|
35
|
-
// eslint-disable-next-line no-unused-vars
|
|
36
|
-
} catch (_) {
|
|
37
|
-
// ignored
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
configure({
|
|
41
|
-
baseURI,
|
|
42
|
-
CompressionStreamZlib,
|
|
43
|
-
DecompressionStreamZlib
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
Reader,
|
|
48
|
-
Writer,
|
|
49
|
-
TextReader,
|
|
50
|
-
TextWriter,
|
|
51
|
-
Data64URIReader,
|
|
52
|
-
Data64URIWriter,
|
|
53
|
-
BlobReader,
|
|
54
|
-
BlobWriter,
|
|
55
|
-
HttpReader,
|
|
56
|
-
HttpRangeReader,
|
|
57
|
-
Uint8ArrayWriter,
|
|
58
|
-
Uint8ArrayReader,
|
|
59
|
-
SplitDataReader,
|
|
60
|
-
SplitDataWriter,
|
|
61
|
-
ERR_HTTP_RANGE
|
|
62
|
-
} from "./core/io.js";
|
|
63
|
-
export {
|
|
64
|
-
ZipReader,
|
|
65
|
-
ZipReaderStream,
|
|
66
|
-
ERR_BAD_FORMAT,
|
|
67
|
-
ERR_EOCDR_NOT_FOUND,
|
|
68
|
-
ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
|
|
69
|
-
ERR_CENTRAL_DIRECTORY_NOT_FOUND,
|
|
70
|
-
ERR_LOCAL_FILE_HEADER_NOT_FOUND,
|
|
71
|
-
ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
|
|
72
|
-
ERR_ENCRYPTED,
|
|
73
|
-
ERR_UNSUPPORTED_ENCRYPTION,
|
|
74
|
-
ERR_UNSUPPORTED_COMPRESSION,
|
|
75
|
-
ERR_INVALID_SIGNATURE,
|
|
76
|
-
ERR_INVALID_UNCOMPRESSED_SIZE,
|
|
77
|
-
ERR_INVALID_PASSWORD,
|
|
78
|
-
ERR_SPLIT_ZIP_FILE,
|
|
79
|
-
ERR_OVERLAPPING_ENTRY
|
|
80
|
-
} from "./core/zip-reader.js";
|
|
81
|
-
export {
|
|
82
|
-
ZipWriter,
|
|
83
|
-
ZipWriterStream,
|
|
84
|
-
ERR_DUPLICATED_NAME,
|
|
85
|
-
ERR_INVALID_COMMENT,
|
|
86
|
-
ERR_INVALID_ENTRY_NAME,
|
|
87
|
-
ERR_INVALID_ENTRY_COMMENT,
|
|
88
|
-
ERR_INVALID_VERSION,
|
|
89
|
-
ERR_INVALID_EXTRAFIELD_TYPE,
|
|
90
|
-
ERR_INVALID_EXTRAFIELD_DATA,
|
|
91
|
-
ERR_INVALID_ENCRYPTION_STRENGTH,
|
|
92
|
-
ERR_UNSUPPORTED_FORMAT,
|
|
93
|
-
ERR_UNDEFINED_UNCOMPRESSED_SIZE,
|
|
94
|
-
ERR_ZIP_NOT_EMPTY
|
|
95
|
-
} from "./core/zip-writer.js";
|
|
96
|
-
export {
|
|
97
|
-
getMimeType
|
|
98
|
-
} from "./core/util/default-mime-type.js";
|
|
99
|
-
export {
|
|
100
|
-
terminateWorkers
|
|
101
|
-
} from "./core/codec-pool.js";
|
|
102
|
-
export {
|
|
103
|
-
resetWasmModule
|
|
104
|
-
} from "./core/streams/zlib/zlib-streams-loader.js";
|
|
105
|
-
export {
|
|
106
|
-
configure
|
|
107
|
-
};
|
|
29
|
+
export * from "./zip-core-base.js";
|
|
30
|
+
export { terminateWorkers } from "./core/codec-pool.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export * from "./zip-core-native.js";
|
|
30
|
+
export * from "./core/zip-fs.js";
|
|
@@ -27,11 +27,9 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import { configure } from "./core/configuration.js";
|
|
30
|
-
import { configureWebWorker } from "./core/web-worker-inline.js";
|
|
31
|
-
import { configureZlibModule } from "./core/zlib-streams-inline.js";
|
|
30
|
+
import { configureWebWorker } from "./core/web-worker-inline-native.js";
|
|
32
31
|
|
|
33
32
|
configureWebWorker(configure);
|
|
34
|
-
configureZlibModule(configure);
|
|
35
33
|
|
|
36
|
-
export * from "./zip-fs-core.js";
|
|
34
|
+
export * from "./zip-fs-core-native.js";
|
|
37
35
|
export { getMimeType } from "./core/util/mime-type.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { configure } from "./core/configuration.js";
|
|
30
|
+
import { configureWebWorker } from "./core/web-worker-inline-wasm.js";
|
|
31
|
+
|
|
32
|
+
configureWebWorker(configure);
|
|
33
|
+
|
|
34
|
+
export * from "./zip-fs-core-wasm.js";
|
|
35
|
+
export { getMimeType } from "./core/util/mime-type.js";
|
|
@@ -27,10 +27,9 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import { configure } from "./core/configuration.js";
|
|
30
|
-
import { configureWebWorker } from "./core/web-worker-inline.js";
|
|
31
|
-
import { configureZlibModule } from "./core/zlib-streams-inline.js";
|
|
30
|
+
import { configureWebWorker } from "./core/web-worker-inline-native.js";
|
|
32
31
|
|
|
33
32
|
configureWebWorker(configure);
|
|
34
|
-
configureZlibModule(configure);
|
|
35
33
|
|
|
36
|
-
export * from "./zip-core.js";
|
|
34
|
+
export * from "./zip-core-base.js";
|
|
35
|
+
export { terminateWorkers } from "./core/codec-pool.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { configure } from "./core/configuration.js";
|
|
30
|
+
import { CompressionStreamZlib, DecompressionStreamZlib } from "./core/streams/zlib-js/zlib-streams.min.js";
|
|
31
|
+
|
|
32
|
+
configure({
|
|
33
|
+
workerURI: "./core/web-worker-native.js",
|
|
34
|
+
wasmURI: null,
|
|
35
|
+
CompressionStreamZlib,
|
|
36
|
+
DecompressionStreamZlib
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { terminateWorkers } from "./core/codec-pool.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { FUNCTION_TYPE } from "./core/constants.js";
|
|
30
|
+
import { configure } from "./core/configuration.js";
|
|
31
|
+
import { configureZlibModule } from "./core/zlib-streams-inline.js";
|
|
32
|
+
import { configureWorker } from "./core/codec-worker.js";
|
|
33
|
+
import { terminateWorkers } from "./core/codec-pool.js";
|
|
34
|
+
import { initModule, initializedModule, resetWasmModule, CompressionStreamZlib, DecompressionStreamZlib } from "./core/streams/zlib-wasm/zlib-streams-loader.js";
|
|
35
|
+
|
|
36
|
+
let initializingModule = false;
|
|
37
|
+
|
|
38
|
+
configureZlibModule(configure);
|
|
39
|
+
configureWorker({
|
|
40
|
+
initModule: config => {
|
|
41
|
+
if (!initializedModule && !initializingModule) {
|
|
42
|
+
let { wasmURI } = config;
|
|
43
|
+
// deno-lint-ignore valid-typeof
|
|
44
|
+
if (typeof wasmURI == FUNCTION_TYPE) {
|
|
45
|
+
wasmURI = wasmURI();
|
|
46
|
+
}
|
|
47
|
+
initializingModule = false;
|
|
48
|
+
return initModule(wasmURI, config);
|
|
49
|
+
}
|
|
50
|
+
initializingModule = true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
configure({
|
|
54
|
+
CompressionStreamZlib,
|
|
55
|
+
DecompressionStreamZlib
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export { terminateWorkersAndModule as terminateWorkers };
|
|
59
|
+
|
|
60
|
+
function terminateWorkersAndModule() {
|
|
61
|
+
terminateWorkers();
|
|
62
|
+
resetWasmModule();
|
|
63
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in
|
|
12
|
+
the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
15
|
+
derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
20
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
22
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
23
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
26
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { configure } from "./core/configuration.js";
|
|
30
|
+
import { configureWebWorker } from "./core/web-worker-inline-native.js";
|
|
31
|
+
|
|
32
|
+
configureWebWorker(configure);
|
|
33
|
+
|
|
34
|
+
export * from "./zip-core-native.js";
|
|
35
|
+
export * from "./zip-module-native.js";
|