@zip.js/zip.js 2.7.66 → 2.7.67

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.
@@ -7,11 +7,28 @@ on:
7
7
  types: [published]
8
8
 
9
9
  jobs:
10
- publish:
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zip-js/zip-js",
3
- "version": "2.7.66",
3
+ "version": "2.7.67",
4
4
  "exports": {
5
5
  ".": "./index.js",
6
6
  "./data-uri": "./lib/zip-data-uri.js"
@@ -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
 
@@ -10043,27 +10044,11 @@
10043
10044
  if (this.filenames.size) {
10044
10045
  throw new Error(ERR_ZIP_NOT_EMPTY);
10045
10046
  }
10046
- ({ reader } = new GenericReader(reader));
10047
- const [zipEntriesReader, zipDataReader] = reader.readable.tee();
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
- }));
10047
+ reader = new GenericReader(reader);
10048
+ const zipReader = new ZipReader(reader.readable);
10064
10049
  const entries = await zipReader.getEntries();
10065
10050
  await zipReader.close();
10066
- await zipDataReader.pipeTo(this.writer.writable, { preventClose: true, preventAbort: true });
10051
+ await reader.readable.pipeTo(this.writer.writable, { preventClose: true, preventAbort: true });
10067
10052
  this.writer.size = this.offset = reader.size;
10068
10053
  this.filenames = new Set(entries.map(entry => entry.filename));
10069
10054
  this.files = new Map(entries.map(entry => {
@@ -10103,7 +10088,7 @@
10103
10088
  headerView
10104
10089
  } = getHeaderArrayData({
10105
10090
  version,
10106
- bitFlag: getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted),
10091
+ bitFlag: getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted, compressionMethod),
10107
10092
  compressionMethod,
10108
10093
  uncompressedSize,
10109
10094
  compressedSize,
@@ -10889,7 +10874,7 @@
10889
10874
  rawLastModDate
10890
10875
  } = getHeaderArrayData({
10891
10876
  version,
10892
- bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted),
10877
+ bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
10893
10878
  compressionMethod,
10894
10879
  uncompressedSize,
10895
10880
  lastModDate: lastModDate < MIN_DATE ? MIN_DATE : lastModDate > MAX_DATE ? MAX_DATE : lastModDate,
@@ -11377,8 +11362,7 @@
11377
11362
  };
11378
11363
  }
11379
11364
 
11380
-
11381
- function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted) {
11365
+ function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod) {
11382
11366
  let bitFlag = 0;
11383
11367
  if (useUnicodeFileNames) {
11384
11368
  bitFlag = bitFlag | BITFLAG_LANG_ENCODING_FLAG;
@@ -11386,14 +11370,16 @@
11386
11370
  if (dataDescriptor) {
11387
11371
  bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
11388
11372
  }
11389
- if (level > 0 && level <= 3) {
11390
- bitFlag = bitFlag | BITFLAG_LEVEL_SUPER_FAST_MASK;
11391
- }
11392
- if (level > 3 && level <= 5) {
11393
- bitFlag = bitFlag | BITFLAG_LEVEL_FAST_MASK;
11394
- }
11395
- if (level == 9) {
11396
- bitFlag = bitFlag | BITFLAG_LEVEL_MAX_MASK;
11373
+ if (compressionMethod == COMPRESSION_METHOD_DEFLATE || compressionMethod == COMPRESSION_METHOD_DEFLATE_64) {
11374
+ if (level >= 0 && level <= 3) {
11375
+ bitFlag = bitFlag | BITFLAG_LEVEL_SUPER_FAST_MASK;
11376
+ }
11377
+ if (level > 3 && level <= 5) {
11378
+ bitFlag = bitFlag | BITFLAG_LEVEL_FAST_MASK;
11379
+ }
11380
+ if (level == 9) {
11381
+ bitFlag = bitFlag | BITFLAG_LEVEL_MAX_MASK;
11382
+ }
11397
11383
  }
11398
11384
  if (encrypted) {
11399
11385
  bitFlag = bitFlag | BITFLAG_ENCRYPTED;