@zip.js/zip.js 2.7.66 → 2.7.68
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/.github/workflows/publish.yml +19 -2
- package/deno.json +1 -1
- package/dist/zip-fs-full.js +28 -35
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +28 -35
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +28 -35
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +28 -35
- package/dist/zip.min.js +1 -1
- package/index.cjs +28 -35
- package/index.min.js +1 -1
- package/lib/core/constants.js +2 -0
- package/lib/core/io.js +11 -4
- package/lib/core/zip-writer.js +18 -32
- package/package.json +2 -2
|
@@ -7,11 +7,28 @@ on:
|
|
|
7
7
|
types: [published]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
|
-
|
|
10
|
+
publish_jsr:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
permissions:
|
|
13
13
|
contents: read
|
|
14
14
|
id-token: write
|
|
15
15
|
steps:
|
|
16
16
|
- uses: actions/checkout@v4
|
|
17
|
-
- run: npx jsr publish
|
|
17
|
+
- run: npx jsr publish
|
|
18
|
+
|
|
19
|
+
publish_npm:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
id-token: write
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
# Setup .npmrc file to publish to npm
|
|
27
|
+
- uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: '20.x'
|
|
30
|
+
registry-url: 'https://registry.npmjs.org'
|
|
31
|
+
- run: npm ci
|
|
32
|
+
- run: npm publish --provenance --access public
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/deno.json
CHANGED
package/dist/zip-fs-full.js
CHANGED
|
@@ -4253,6 +4253,7 @@
|
|
|
4253
4253
|
const MAX_32_BITS = 0xffffffff;
|
|
4254
4254
|
const MAX_16_BITS = 0xffff;
|
|
4255
4255
|
const COMPRESSION_METHOD_DEFLATE = 0x08;
|
|
4256
|
+
const COMPRESSION_METHOD_DEFLATE_64 = 0x09;
|
|
4256
4257
|
const COMPRESSION_METHOD_STORE = 0x00;
|
|
4257
4258
|
const COMPRESSION_METHOD_AES = 0x63;
|
|
4258
4259
|
|
|
@@ -8751,11 +8752,18 @@
|
|
|
8751
8752
|
if (eocdCache && index == size - END_OF_CENTRAL_DIR_LENGTH && length == END_OF_CENTRAL_DIR_LENGTH) {
|
|
8752
8753
|
return eocdCache;
|
|
8753
8754
|
}
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8755
|
+
if (index >= size) {
|
|
8756
|
+
return new Uint8Array();
|
|
8757
|
+
} else {
|
|
8758
|
+
if (index + length > size) {
|
|
8759
|
+
length = size - index;
|
|
8760
|
+
}
|
|
8761
|
+
const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
|
|
8762
|
+
if (response.status != 206) {
|
|
8763
|
+
throw new Error(ERR_HTTP_RANGE);
|
|
8764
|
+
}
|
|
8765
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
8757
8766
|
}
|
|
8758
|
-
return new Uint8Array(await response.arrayBuffer());
|
|
8759
8767
|
} else {
|
|
8760
8768
|
const { data } = httpReader;
|
|
8761
8769
|
if (!data) {
|
|
@@ -10043,27 +10051,11 @@
|
|
|
10043
10051
|
if (this.filenames.size) {
|
|
10044
10052
|
throw new Error(ERR_ZIP_NOT_EMPTY);
|
|
10045
10053
|
}
|
|
10046
|
-
|
|
10047
|
-
const
|
|
10048
|
-
const zipReader = new ZipReader(new ReadableStream({
|
|
10049
|
-
async start(controller) {
|
|
10050
|
-
const reader = zipEntriesReader.getReader();
|
|
10051
|
-
await readChunk();
|
|
10052
|
-
|
|
10053
|
-
async function readChunk() {
|
|
10054
|
-
const { done, value } = await reader.read();
|
|
10055
|
-
if (done) {
|
|
10056
|
-
controller.close();
|
|
10057
|
-
} else {
|
|
10058
|
-
controller.enqueue(value);
|
|
10059
|
-
await readChunk();
|
|
10060
|
-
}
|
|
10061
|
-
}
|
|
10062
|
-
}
|
|
10063
|
-
}));
|
|
10054
|
+
reader = new GenericReader(reader);
|
|
10055
|
+
const zipReader = new ZipReader(reader.readable);
|
|
10064
10056
|
const entries = await zipReader.getEntries();
|
|
10065
10057
|
await zipReader.close();
|
|
10066
|
-
await
|
|
10058
|
+
await reader.readable.pipeTo(this.writer.writable, { preventClose: true, preventAbort: true });
|
|
10067
10059
|
this.writer.size = this.offset = reader.size;
|
|
10068
10060
|
this.filenames = new Set(entries.map(entry => entry.filename));
|
|
10069
10061
|
this.files = new Map(entries.map(entry => {
|
|
@@ -10103,7 +10095,7 @@
|
|
|
10103
10095
|
headerView
|
|
10104
10096
|
} = getHeaderArrayData({
|
|
10105
10097
|
version,
|
|
10106
|
-
bitFlag: getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted),
|
|
10098
|
+
bitFlag: getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted, compressionMethod),
|
|
10107
10099
|
compressionMethod,
|
|
10108
10100
|
uncompressedSize,
|
|
10109
10101
|
compressedSize,
|
|
@@ -10889,7 +10881,7 @@
|
|
|
10889
10881
|
rawLastModDate
|
|
10890
10882
|
} = getHeaderArrayData({
|
|
10891
10883
|
version,
|
|
10892
|
-
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted),
|
|
10884
|
+
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
10893
10885
|
compressionMethod,
|
|
10894
10886
|
uncompressedSize,
|
|
10895
10887
|
lastModDate: lastModDate < MIN_DATE ? MIN_DATE : lastModDate > MAX_DATE ? MAX_DATE : lastModDate,
|
|
@@ -11377,8 +11369,7 @@
|
|
|
11377
11369
|
};
|
|
11378
11370
|
}
|
|
11379
11371
|
|
|
11380
|
-
|
|
11381
|
-
function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted) {
|
|
11372
|
+
function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod) {
|
|
11382
11373
|
let bitFlag = 0;
|
|
11383
11374
|
if (useUnicodeFileNames) {
|
|
11384
11375
|
bitFlag = bitFlag | BITFLAG_LANG_ENCODING_FLAG;
|
|
@@ -11386,14 +11377,16 @@
|
|
|
11386
11377
|
if (dataDescriptor) {
|
|
11387
11378
|
bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
|
|
11388
11379
|
}
|
|
11389
|
-
if (
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11380
|
+
if (compressionMethod == COMPRESSION_METHOD_DEFLATE || compressionMethod == COMPRESSION_METHOD_DEFLATE_64) {
|
|
11381
|
+
if (level >= 0 && level <= 3) {
|
|
11382
|
+
bitFlag = bitFlag | BITFLAG_LEVEL_SUPER_FAST_MASK;
|
|
11383
|
+
}
|
|
11384
|
+
if (level > 3 && level <= 5) {
|
|
11385
|
+
bitFlag = bitFlag | BITFLAG_LEVEL_FAST_MASK;
|
|
11386
|
+
}
|
|
11387
|
+
if (level == 9) {
|
|
11388
|
+
bitFlag = bitFlag | BITFLAG_LEVEL_MAX_MASK;
|
|
11389
|
+
}
|
|
11397
11390
|
}
|
|
11398
11391
|
if (encrypted) {
|
|
11399
11392
|
bitFlag = bitFlag | BITFLAG_ENCRYPTED;
|