@cj-tech-master/excelts 4.2.0 → 4.2.1-canary.20260112134913.a3cecdd
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/THIRD_PARTY_NOTICES.md +0 -31
- package/dist/browser/index.browser.d.ts +1 -0
- package/dist/browser/index.browser.js +12 -0
- package/dist/{types/modules/archive → browser/modules/archive/compression}/compress.base.d.ts +1 -0
- package/dist/browser/modules/archive/{compress.base.js → compression/compress.base.js} +2 -1
- package/dist/{types/modules/archive → browser/modules/archive/compression}/compress.browser.d.ts +10 -8
- package/dist/{esm/modules/archive → browser/modules/archive/compression}/compress.browser.js +18 -19
- package/dist/browser/modules/archive/{compress.d.ts → compression/compress.d.ts} +2 -2
- package/dist/browser/modules/archive/{compress.js → compression/compress.js} +1 -1
- package/dist/browser/modules/archive/{crc32.browser.d.ts → compression/crc32.browser.d.ts} +1 -1
- package/dist/browser/modules/archive/{crc32.d.ts → compression/crc32.d.ts} +1 -1
- package/dist/browser/modules/archive/{crc32.js → compression/crc32.js} +1 -1
- package/dist/browser/modules/archive/{deflate-fallback.js → compression/deflate-fallback.js} +1 -1
- package/dist/browser/modules/archive/{streaming-compress.browser.d.ts → compression/streaming-compress.browser.d.ts} +2 -2
- package/dist/browser/modules/archive/{streaming-compress.browser.js → compression/streaming-compress.browser.js} +3 -3
- package/dist/browser/modules/archive/{streaming-compress.d.ts → compression/streaming-compress.d.ts} +2 -2
- package/dist/browser/modules/archive/{streaming-compress.js → compression/streaming-compress.js} +2 -2
- package/dist/browser/modules/archive/defaults.d.ts +1 -0
- package/dist/browser/modules/archive/defaults.js +6 -3
- package/dist/browser/modules/archive/index.base.d.ts +4 -4
- package/dist/browser/modules/archive/index.base.js +3 -6
- package/dist/browser/modules/archive/index.browser.d.ts +3 -4
- package/dist/browser/modules/archive/index.browser.js +3 -7
- package/dist/browser/modules/archive/index.d.ts +3 -4
- package/dist/browser/modules/archive/index.js +3 -5
- package/dist/browser/modules/archive/internal/byte-queue.d.ts +33 -0
- package/dist/browser/modules/archive/internal/byte-queue.js +407 -0
- package/dist/browser/modules/archive/io/archive-sink.d.ts +8 -0
- package/dist/browser/modules/archive/io/archive-sink.js +45 -0
- package/dist/browser/modules/archive/io/archive-source.d.ts +6 -0
- package/dist/browser/modules/archive/io/archive-source.js +100 -0
- package/dist/browser/modules/archive/{extract.d.ts → unzip/extract.d.ts} +2 -2
- package/dist/browser/modules/archive/unzip/index.d.ts +40 -0
- package/dist/browser/modules/archive/unzip/index.js +164 -0
- package/dist/browser/modules/archive/{parse.base.d.ts → unzip/stream.base.d.ts} +58 -3
- package/dist/browser/modules/archive/unzip/stream.base.js +1022 -0
- package/dist/browser/modules/archive/{parse.browser.d.ts → unzip/stream.browser.d.ts} +1 -1
- package/dist/browser/modules/archive/{parse.browser.js → unzip/stream.browser.js} +376 -110
- package/dist/browser/modules/archive/{parse.d.ts → unzip/stream.d.ts} +2 -2
- package/dist/{esm/modules/archive/parse.js → browser/modules/archive/unzip/stream.js} +7 -6
- package/dist/{types/modules/archive → browser/modules/archive/unzip}/zip-parser.d.ts +1 -1
- package/dist/{esm/modules/archive → browser/modules/archive/unzip}/zip-parser.js +38 -24
- package/dist/browser/modules/archive/utils/async-queue.d.ts +7 -0
- package/dist/browser/modules/archive/utils/async-queue.js +103 -0
- package/dist/browser/modules/archive/utils/bytes.js +16 -16
- package/dist/browser/modules/archive/utils/compressibility.d.ts +10 -0
- package/dist/browser/modules/archive/utils/compressibility.js +57 -0
- package/dist/browser/modules/archive/utils/parse-buffer.js +21 -23
- package/dist/browser/modules/archive/utils/pattern-scanner.d.ts +21 -0
- package/dist/browser/modules/archive/utils/pattern-scanner.js +27 -0
- package/dist/browser/modules/archive/utils/timestamps.js +62 -1
- package/dist/browser/modules/archive/utils/zip-extra-fields.d.ts +1 -1
- package/dist/browser/modules/archive/utils/zip-extra-fields.js +26 -14
- package/dist/browser/modules/archive/zip/index.d.ts +42 -0
- package/dist/browser/modules/archive/zip/index.js +157 -0
- package/dist/browser/modules/archive/{streaming-zip.d.ts → zip/stream.d.ts} +28 -5
- package/dist/browser/modules/archive/{streaming-zip.js → zip/stream.js} +192 -48
- package/dist/browser/modules/archive/zip/zip-bytes.d.ts +73 -0
- package/dist/browser/modules/archive/zip/zip-bytes.js +239 -0
- package/dist/{esm/modules/archive → browser/modules/archive/zip}/zip-entry-metadata.js +3 -3
- package/dist/browser/modules/archive/{zip-records.d.ts → zip-spec/zip-records.d.ts} +20 -0
- package/dist/browser/modules/archive/zip-spec/zip-records.js +126 -0
- package/dist/browser/modules/excel/form-control.d.ts +2 -0
- package/dist/browser/modules/excel/form-control.js +54 -16
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +1 -1
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +1 -1
- package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +48 -0
- package/dist/browser/modules/excel/utils/ooxml-validator.js +469 -0
- package/dist/browser/modules/excel/worksheet.js +5 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +13 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/sp-xform.d.ts +18 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/sp-xform.js +112 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +6 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +30 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +11 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/page-setup-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/page-setup-xform.js +16 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +117 -5
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +3 -6
- package/dist/browser/modules/excel/xlsx/xlsx.js +1 -1
- package/dist/browser/modules/stream/base-transform.d.ts +3 -0
- package/dist/browser/modules/stream/base-transform.js +34 -20
- package/dist/browser/modules/stream/buffered-stream.d.ts +2 -12
- package/dist/browser/modules/stream/chunked-builder.js +4 -4
- package/dist/browser/modules/stream/index.browser.d.ts +13 -19
- package/dist/browser/modules/stream/index.browser.js +10 -22
- package/dist/browser/modules/stream/index.d.ts +18 -41
- package/dist/browser/modules/stream/index.js +15 -44
- package/dist/browser/modules/stream/internal/event-utils.d.ts +17 -0
- package/dist/browser/modules/stream/internal/event-utils.js +40 -0
- package/dist/browser/modules/stream/internal/type-guards.d.ts +9 -0
- package/dist/browser/modules/stream/internal/type-guards.js +24 -0
- package/dist/browser/modules/stream/pull-stream.d.ts +5 -6
- package/dist/browser/modules/stream/pull-stream.js +107 -43
- package/dist/browser/modules/stream/shared.d.ts +1 -1
- package/dist/browser/modules/stream/shared.js +7 -4
- package/dist/browser/modules/stream/streams.browser.d.ts +32 -42
- package/dist/browser/modules/stream/streams.browser.js +941 -823
- package/dist/browser/modules/stream/streams.d.ts +4 -20
- package/dist/browser/modules/stream/streams.js +146 -95
- package/dist/browser/modules/stream/utils.js +5 -38
- package/dist/cjs/modules/archive/{compress.base.js → compression/compress.base.js} +2 -1
- package/dist/cjs/modules/archive/{compress.browser.js → compression/compress.browser.js} +18 -19
- package/dist/cjs/modules/archive/{compress.js → compression/compress.js} +1 -1
- package/dist/cjs/modules/archive/{crc32.js → compression/crc32.js} +1 -1
- package/dist/cjs/modules/archive/{deflate-fallback.js → compression/deflate-fallback.js} +1 -1
- package/dist/cjs/modules/archive/{streaming-compress.browser.js → compression/streaming-compress.browser.js} +3 -3
- package/dist/cjs/modules/archive/{streaming-compress.js → compression/streaming-compress.js} +2 -2
- package/dist/cjs/modules/archive/defaults.js +7 -4
- package/dist/cjs/modules/archive/index.base.js +9 -19
- package/dist/cjs/modules/archive/index.browser.js +4 -10
- package/dist/cjs/modules/archive/index.js +4 -8
- package/dist/cjs/modules/archive/internal/byte-queue.js +411 -0
- package/dist/cjs/modules/archive/io/archive-sink.js +49 -0
- package/dist/cjs/modules/archive/io/archive-source.js +105 -0
- package/dist/cjs/modules/archive/unzip/index.js +170 -0
- package/dist/cjs/modules/archive/unzip/stream.base.js +1044 -0
- package/dist/cjs/modules/archive/{parse.browser.js → unzip/stream.browser.js} +377 -111
- package/dist/cjs/modules/archive/{parse.js → unzip/stream.js} +9 -8
- package/dist/cjs/modules/archive/{zip-parser.js → unzip/zip-parser.js} +47 -33
- package/dist/cjs/modules/archive/utils/async-queue.js +106 -0
- package/dist/cjs/modules/archive/utils/bytes.js +16 -16
- package/dist/cjs/modules/archive/utils/compressibility.js +60 -0
- package/dist/cjs/modules/archive/utils/parse-buffer.js +21 -23
- package/dist/cjs/modules/archive/utils/pattern-scanner.js +31 -0
- package/dist/cjs/modules/archive/utils/timestamps.js +64 -3
- package/dist/cjs/modules/archive/utils/zip-extra-fields.js +26 -14
- package/dist/cjs/modules/archive/zip/index.js +162 -0
- package/dist/cjs/modules/archive/{streaming-zip.js → zip/stream.js} +194 -50
- package/dist/cjs/modules/archive/zip/zip-bytes.js +242 -0
- package/dist/cjs/modules/archive/{zip-entry-metadata.js → zip/zip-entry-metadata.js} +5 -5
- package/dist/cjs/modules/archive/zip-spec/zip-records.js +136 -0
- package/dist/cjs/modules/excel/form-control.js +54 -16
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +2 -2
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +4 -4
- package/dist/cjs/modules/excel/utils/ooxml-validator.js +475 -0
- package/dist/cjs/modules/excel/worksheet.js +5 -2
- package/dist/cjs/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +13 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/sp-xform.js +115 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +30 -2
- package/dist/cjs/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +11 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/page-setup-xform.js +16 -2
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +117 -5
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +6 -9
- package/dist/cjs/modules/excel/xlsx/xlsx.js +2 -2
- package/dist/cjs/modules/stream/base-transform.js +34 -20
- package/dist/cjs/modules/stream/chunked-builder.js +4 -4
- package/dist/cjs/modules/stream/index.browser.js +10 -17
- package/dist/cjs/modules/stream/index.js +15 -39
- package/dist/cjs/modules/stream/internal/event-utils.js +43 -0
- package/dist/cjs/modules/stream/internal/type-guards.js +30 -0
- package/dist/cjs/modules/stream/pull-stream.js +107 -43
- package/dist/cjs/modules/stream/shared.js +7 -4
- package/dist/cjs/modules/stream/streams.browser.js +947 -834
- package/dist/cjs/modules/stream/streams.js +156 -107
- package/dist/cjs/modules/stream/utils.js +3 -36
- package/dist/esm/index.browser.js +12 -0
- package/dist/esm/modules/archive/{compress.base.js → compression/compress.base.js} +2 -1
- package/dist/{browser/modules/archive → esm/modules/archive/compression}/compress.browser.js +18 -19
- package/dist/esm/modules/archive/{compress.js → compression/compress.js} +1 -1
- package/dist/esm/modules/archive/{crc32.js → compression/crc32.js} +1 -1
- package/dist/esm/modules/archive/{deflate-fallback.js → compression/deflate-fallback.js} +1 -1
- package/dist/esm/modules/archive/{streaming-compress.browser.js → compression/streaming-compress.browser.js} +3 -3
- package/dist/esm/modules/archive/{streaming-compress.js → compression/streaming-compress.js} +2 -2
- package/dist/esm/modules/archive/defaults.js +6 -3
- package/dist/esm/modules/archive/index.base.js +3 -6
- package/dist/esm/modules/archive/index.browser.js +3 -7
- package/dist/esm/modules/archive/index.js +3 -5
- package/dist/esm/modules/archive/internal/byte-queue.js +407 -0
- package/dist/esm/modules/archive/io/archive-sink.js +45 -0
- package/dist/esm/modules/archive/io/archive-source.js +100 -0
- package/dist/esm/modules/archive/unzip/index.js +164 -0
- package/dist/esm/modules/archive/unzip/stream.base.js +1022 -0
- package/dist/esm/modules/archive/{parse.browser.js → unzip/stream.browser.js} +376 -110
- package/dist/{browser/modules/archive/parse.js → esm/modules/archive/unzip/stream.js} +7 -6
- package/dist/{browser/modules/archive → esm/modules/archive/unzip}/zip-parser.js +38 -24
- package/dist/esm/modules/archive/utils/async-queue.js +103 -0
- package/dist/esm/modules/archive/utils/bytes.js +16 -16
- package/dist/esm/modules/archive/utils/compressibility.js +57 -0
- package/dist/esm/modules/archive/utils/parse-buffer.js +21 -23
- package/dist/esm/modules/archive/utils/pattern-scanner.js +27 -0
- package/dist/esm/modules/archive/utils/timestamps.js +62 -1
- package/dist/esm/modules/archive/utils/zip-extra-fields.js +26 -14
- package/dist/esm/modules/archive/zip/index.js +157 -0
- package/dist/esm/modules/archive/{streaming-zip.js → zip/stream.js} +192 -48
- package/dist/esm/modules/archive/zip/zip-bytes.js +239 -0
- package/dist/{browser/modules/archive → esm/modules/archive/zip}/zip-entry-metadata.js +3 -3
- package/dist/esm/modules/archive/zip-spec/zip-records.js +126 -0
- package/dist/esm/modules/excel/form-control.js +54 -16
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +1 -1
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +1 -1
- package/dist/esm/modules/excel/utils/ooxml-validator.js +469 -0
- package/dist/esm/modules/excel/worksheet.js +5 -2
- package/dist/esm/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +13 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/sp-xform.js +112 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +30 -2
- package/dist/esm/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +11 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/page-setup-xform.js +16 -2
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +117 -5
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +3 -6
- package/dist/esm/modules/excel/xlsx/xlsx.js +1 -1
- package/dist/esm/modules/stream/base-transform.js +34 -20
- package/dist/esm/modules/stream/chunked-builder.js +4 -4
- package/dist/esm/modules/stream/index.browser.js +10 -22
- package/dist/esm/modules/stream/index.js +15 -44
- package/dist/esm/modules/stream/internal/event-utils.js +40 -0
- package/dist/esm/modules/stream/internal/type-guards.js +24 -0
- package/dist/esm/modules/stream/pull-stream.js +107 -43
- package/dist/esm/modules/stream/shared.js +7 -4
- package/dist/esm/modules/stream/streams.browser.js +941 -823
- package/dist/esm/modules/stream/streams.js +146 -95
- package/dist/esm/modules/stream/utils.js +5 -38
- package/dist/iife/THIRD_PARTY_NOTICES.md +81 -0
- package/dist/iife/excelts.iife.js +4979 -2800
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +103 -31
- package/dist/types/index.browser.d.ts +1 -0
- package/dist/{browser/modules/archive → types/modules/archive/compression}/compress.base.d.ts +1 -0
- package/dist/{browser/modules/archive → types/modules/archive/compression}/compress.browser.d.ts +10 -8
- package/dist/types/modules/archive/{streaming-compress.browser.d.ts → compression/streaming-compress.browser.d.ts} +1 -1
- package/dist/types/modules/archive/defaults.d.ts +1 -0
- package/dist/types/modules/archive/index.base.d.ts +4 -4
- package/dist/types/modules/archive/index.browser.d.ts +3 -4
- package/dist/types/modules/archive/index.d.ts +3 -4
- package/dist/types/modules/archive/internal/byte-queue.d.ts +33 -0
- package/dist/types/modules/archive/io/archive-sink.d.ts +8 -0
- package/dist/types/modules/archive/io/archive-source.d.ts +6 -0
- package/dist/types/modules/archive/unzip/index.d.ts +40 -0
- package/dist/types/modules/archive/{parse.base.d.ts → unzip/stream.base.d.ts} +60 -5
- package/dist/types/modules/archive/{parse.browser.d.ts → unzip/stream.browser.d.ts} +2 -2
- package/dist/types/modules/archive/{parse.d.ts → unzip/stream.d.ts} +3 -3
- package/dist/{browser/modules/archive → types/modules/archive/unzip}/zip-parser.d.ts +1 -1
- package/dist/types/modules/archive/utils/async-queue.d.ts +7 -0
- package/dist/types/modules/archive/utils/compressibility.d.ts +10 -0
- package/dist/types/modules/archive/utils/pattern-scanner.d.ts +21 -0
- package/dist/types/modules/archive/utils/zip-extra-fields.d.ts +1 -1
- package/dist/types/modules/archive/zip/index.d.ts +42 -0
- package/dist/types/modules/archive/{streaming-zip.d.ts → zip/stream.d.ts} +29 -6
- package/dist/types/modules/archive/zip/zip-bytes.d.ts +73 -0
- package/dist/types/modules/archive/{zip-entry-metadata.d.ts → zip/zip-entry-metadata.d.ts} +1 -1
- package/dist/types/modules/archive/{zip-records.d.ts → zip-spec/zip-records.d.ts} +20 -0
- package/dist/types/modules/excel/form-control.d.ts +2 -0
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
- package/dist/types/modules/excel/utils/ooxml-validator.d.ts +48 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/sp-xform.d.ts +18 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +6 -1
- package/dist/types/modules/excel/xlsx/xform/sheet/page-setup-xform.d.ts +1 -0
- package/dist/types/modules/stream/base-transform.d.ts +3 -0
- package/dist/types/modules/stream/buffered-stream.d.ts +2 -12
- package/dist/types/modules/stream/index.browser.d.ts +13 -19
- package/dist/types/modules/stream/index.d.ts +18 -41
- package/dist/types/modules/stream/internal/event-utils.d.ts +17 -0
- package/dist/types/modules/stream/internal/type-guards.d.ts +9 -0
- package/dist/types/modules/stream/pull-stream.d.ts +5 -6
- package/dist/types/modules/stream/shared.d.ts +1 -1
- package/dist/types/modules/stream/streams.browser.d.ts +32 -42
- package/dist/types/modules/stream/streams.d.ts +4 -20
- package/package.json +19 -15
- package/dist/browser/modules/archive/byte-queue.d.ts +0 -18
- package/dist/browser/modules/archive/byte-queue.js +0 -125
- package/dist/browser/modules/archive/parse.base.js +0 -610
- package/dist/browser/modules/archive/utils/zip-extra.d.ts +0 -18
- package/dist/browser/modules/archive/utils/zip-extra.js +0 -68
- package/dist/browser/modules/archive/zip-builder.d.ts +0 -117
- package/dist/browser/modules/archive/zip-builder.js +0 -292
- package/dist/browser/modules/archive/zip-constants.d.ts +0 -18
- package/dist/browser/modules/archive/zip-constants.js +0 -23
- package/dist/browser/modules/archive/zip-records.js +0 -84
- package/dist/cjs/modules/archive/byte-queue.js +0 -129
- package/dist/cjs/modules/archive/parse.base.js +0 -632
- package/dist/cjs/modules/archive/utils/zip-extra.js +0 -74
- package/dist/cjs/modules/archive/zip-builder.js +0 -297
- package/dist/cjs/modules/archive/zip-constants.js +0 -26
- package/dist/cjs/modules/archive/zip-records.js +0 -90
- package/dist/esm/modules/archive/byte-queue.js +0 -125
- package/dist/esm/modules/archive/parse.base.js +0 -610
- package/dist/esm/modules/archive/utils/zip-extra.js +0 -68
- package/dist/esm/modules/archive/zip-builder.js +0 -292
- package/dist/esm/modules/archive/zip-constants.js +0 -23
- package/dist/esm/modules/archive/zip-records.js +0 -84
- package/dist/types/modules/archive/byte-queue.d.ts +0 -18
- package/dist/types/modules/archive/utils/zip-extra.d.ts +0 -18
- package/dist/types/modules/archive/zip-builder.d.ts +0 -117
- package/dist/types/modules/archive/zip-constants.d.ts +0 -18
- /package/dist/browser/modules/archive/{crc32.base.d.ts → compression/crc32.base.d.ts} +0 -0
- /package/dist/browser/modules/archive/{crc32.base.js → compression/crc32.base.js} +0 -0
- /package/dist/browser/modules/archive/{crc32.browser.js → compression/crc32.browser.js} +0 -0
- /package/dist/browser/modules/archive/{deflate-fallback.d.ts → compression/deflate-fallback.d.ts} +0 -0
- /package/dist/browser/modules/archive/{streaming-compress.base.d.ts → compression/streaming-compress.base.d.ts} +0 -0
- /package/dist/browser/modules/archive/{streaming-compress.base.js → compression/streaming-compress.base.js} +0 -0
- /package/dist/browser/modules/archive/{extract.js → unzip/extract.js} +0 -0
- /package/dist/browser/modules/archive/{zip-entry-metadata.d.ts → zip/zip-entry-metadata.d.ts} +0 -0
- /package/dist/browser/modules/archive/{zip-entry-info.d.ts → zip-spec/zip-entry-info.d.ts} +0 -0
- /package/dist/browser/modules/archive/{zip-entry-info.js → zip-spec/zip-entry-info.js} +0 -0
- /package/dist/cjs/modules/archive/{crc32.base.js → compression/crc32.base.js} +0 -0
- /package/dist/cjs/modules/archive/{crc32.browser.js → compression/crc32.browser.js} +0 -0
- /package/dist/cjs/modules/archive/{streaming-compress.base.js → compression/streaming-compress.base.js} +0 -0
- /package/dist/cjs/modules/archive/{extract.js → unzip/extract.js} +0 -0
- /package/dist/cjs/modules/archive/{zip-entry-info.js → zip-spec/zip-entry-info.js} +0 -0
- /package/dist/esm/modules/archive/{crc32.base.js → compression/crc32.base.js} +0 -0
- /package/dist/esm/modules/archive/{crc32.browser.js → compression/crc32.browser.js} +0 -0
- /package/dist/esm/modules/archive/{streaming-compress.base.js → compression/streaming-compress.base.js} +0 -0
- /package/dist/esm/modules/archive/{extract.js → unzip/extract.js} +0 -0
- /package/dist/esm/modules/archive/{zip-entry-info.js → zip-spec/zip-entry-info.js} +0 -0
- /package/dist/{LICENSE → iife/LICENSE} +0 -0
- /package/dist/types/modules/archive/{compress.d.ts → compression/compress.d.ts} +0 -0
- /package/dist/types/modules/archive/{crc32.base.d.ts → compression/crc32.base.d.ts} +0 -0
- /package/dist/types/modules/archive/{crc32.browser.d.ts → compression/crc32.browser.d.ts} +0 -0
- /package/dist/types/modules/archive/{crc32.d.ts → compression/crc32.d.ts} +0 -0
- /package/dist/types/modules/archive/{deflate-fallback.d.ts → compression/deflate-fallback.d.ts} +0 -0
- /package/dist/types/modules/archive/{streaming-compress.base.d.ts → compression/streaming-compress.base.d.ts} +0 -0
- /package/dist/types/modules/archive/{streaming-compress.d.ts → compression/streaming-compress.d.ts} +0 -0
- /package/dist/types/modules/archive/{extract.d.ts → unzip/extract.d.ts} +0 -0
- /package/dist/types/modules/archive/{zip-entry-info.d.ts → zip-spec/zip-entry-info.d.ts} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Provides Readable, Writable, Transform, Duplex, and PassThrough streams.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.promises = exports.consumers = exports.
|
|
9
|
+
exports.promises = exports.consumers = exports.Collector = exports.BufferChunk = exports.StringChunk = exports.BufferedStream = exports.PullStream = exports.PassThrough = exports.Duplex = exports.Transform = exports.Readable = exports.Writable = void 0;
|
|
10
10
|
exports.normalizeWritable = normalizeWritable;
|
|
11
11
|
exports.pipeline = pipeline;
|
|
12
12
|
exports.finished = finished;
|
|
@@ -52,7 +52,12 @@ Object.defineProperty(exports, "Transform", { enumerable: true, get: function ()
|
|
|
52
52
|
Object.defineProperty(exports, "Duplex", { enumerable: true, get: function () { return stream_1.Duplex; } });
|
|
53
53
|
Object.defineProperty(exports, "PassThrough", { enumerable: true, get: function () { return stream_1.PassThrough; } });
|
|
54
54
|
const buffered_stream_1 = require("./buffered-stream.js");
|
|
55
|
+
Object.defineProperty(exports, "BufferedStream", { enumerable: true, get: function () { return buffered_stream_1.BufferedStream; } });
|
|
56
|
+
Object.defineProperty(exports, "BufferChunk", { enumerable: true, get: function () { return buffered_stream_1.BufferChunk; } });
|
|
57
|
+
Object.defineProperty(exports, "StringChunk", { enumerable: true, get: function () { return buffered_stream_1.StringChunk; } });
|
|
55
58
|
const pull_stream_1 = require("./pull-stream.js");
|
|
59
|
+
Object.defineProperty(exports, "PullStream", { enumerable: true, get: function () { return pull_stream_1.PullStream; } });
|
|
60
|
+
const type_guards_1 = require("./internal/type-guards.js");
|
|
56
61
|
/**
|
|
57
62
|
* Unified Writable class - wraps Node.js Writable with browser-compatible API
|
|
58
63
|
*
|
|
@@ -62,20 +67,34 @@ class Writable extends stream_1.Writable {
|
|
|
62
67
|
constructor(options) {
|
|
63
68
|
// If wrapping an existing stream, proxy to it
|
|
64
69
|
if (options?.stream) {
|
|
70
|
+
const underlying = options.stream;
|
|
65
71
|
// Create a pass-through wrapper that proxies to the underlying stream
|
|
66
72
|
super({
|
|
67
73
|
highWaterMark: options?.highWaterMark,
|
|
68
74
|
objectMode: options?.objectMode,
|
|
69
75
|
write(chunk, encoding, callback) {
|
|
70
|
-
|
|
76
|
+
underlying.write(chunk, encoding, callback);
|
|
71
77
|
},
|
|
72
78
|
final(callback) {
|
|
73
|
-
|
|
79
|
+
underlying.end(callback);
|
|
74
80
|
}
|
|
75
81
|
});
|
|
76
|
-
// Proxy events from underlying stream
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
// Proxy events from underlying stream, but ensure we clean up listeners so
|
|
83
|
+
// the underlying stream cannot retain this wrapper longer than necessary.
|
|
84
|
+
const onUnderlyingError = (err) => {
|
|
85
|
+
this.emit("error", err);
|
|
86
|
+
};
|
|
87
|
+
const onUnderlyingClose = () => {
|
|
88
|
+
this.emit("close");
|
|
89
|
+
};
|
|
90
|
+
const cleanup = () => {
|
|
91
|
+
underlying.off("error", onUnderlyingError);
|
|
92
|
+
underlying.off("close", onUnderlyingClose);
|
|
93
|
+
};
|
|
94
|
+
underlying.on("error", onUnderlyingError);
|
|
95
|
+
underlying.on("close", onUnderlyingClose);
|
|
96
|
+
this.once("close", cleanup);
|
|
97
|
+
this.once("finish", cleanup);
|
|
79
98
|
}
|
|
80
99
|
else {
|
|
81
100
|
super({
|
|
@@ -100,43 +119,25 @@ function normalizeWritable(stream) {
|
|
|
100
119
|
if (stream instanceof Writable) {
|
|
101
120
|
return stream;
|
|
102
121
|
}
|
|
103
|
-
// Node.js Writable:
|
|
122
|
+
// Node.js Writable: already compatible, avoid extra wrapper allocation.
|
|
104
123
|
if (stream instanceof stream_1.Writable) {
|
|
105
|
-
return
|
|
124
|
+
return stream;
|
|
106
125
|
}
|
|
107
126
|
// Web WritableStream: detect by getWriter() (avoid relying on global WritableStream).
|
|
108
127
|
if (stream?.getWriter) {
|
|
109
|
-
|
|
110
|
-
return new Writable({ stream: nodeWritable });
|
|
128
|
+
return stream_1.Writable.fromWeb(stream);
|
|
111
129
|
}
|
|
112
|
-
// Assume it structurally matches Node's Writable
|
|
113
|
-
return
|
|
130
|
+
// Assume it structurally matches Node's Writable.
|
|
131
|
+
return stream;
|
|
114
132
|
}
|
|
115
133
|
// Import for internal use
|
|
116
134
|
const shared_1 = require("./shared.js");
|
|
117
|
-
const isReadableStream = (value) => !!value && typeof value === "object" && typeof value.getReader === "function";
|
|
118
|
-
const isAsyncIterable = (value) => {
|
|
119
|
-
if (!value || (typeof value !== "object" && typeof value !== "function")) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
return typeof value[Symbol.asyncIterator] === "function";
|
|
123
|
-
};
|
|
124
|
-
const isWritableStream = (value) => !!value && typeof value === "object" && typeof value.getWriter === "function";
|
|
125
|
-
const isTransformStream = (value) => !!value &&
|
|
126
|
-
typeof value === "object" &&
|
|
127
|
-
!!value.readable &&
|
|
128
|
-
!!value.writable &&
|
|
129
|
-
isReadableStream(value.readable) &&
|
|
130
|
-
isWritableStream(value.writable);
|
|
131
135
|
const isPipelineOptions = (value) => {
|
|
132
136
|
if (!value || typeof value !== "object") {
|
|
133
137
|
return false;
|
|
134
138
|
}
|
|
135
|
-
//
|
|
136
|
-
// Do NOT use `"end" in obj` here because streams have `.end()` and would be
|
|
137
|
-
// misclassified as options, breaking argument parsing and potentially hanging.
|
|
139
|
+
// Avoid treating streams as options objects.
|
|
138
140
|
if (typeof value.pipe === "function" ||
|
|
139
|
-
typeof value.write === "function" ||
|
|
140
141
|
typeof value.end === "function" ||
|
|
141
142
|
typeof value.getReader === "function" ||
|
|
142
143
|
typeof value.getWriter === "function") {
|
|
@@ -153,13 +154,13 @@ const toNodePipelineStream = (stream) => {
|
|
|
153
154
|
stream instanceof stream_1.Writable) {
|
|
154
155
|
return stream;
|
|
155
156
|
}
|
|
156
|
-
if (isTransformStream(stream)) {
|
|
157
|
+
if ((0, type_guards_1.isTransformStream)(stream)) {
|
|
157
158
|
return stream_1.Transform.fromWeb(stream);
|
|
158
159
|
}
|
|
159
|
-
if (isReadableStream(stream)) {
|
|
160
|
+
if ((0, type_guards_1.isReadableStream)(stream)) {
|
|
160
161
|
return stream_1.Readable.fromWeb(stream);
|
|
161
162
|
}
|
|
162
|
-
if (isWritableStream(stream)) {
|
|
163
|
+
if ((0, type_guards_1.isWritableStream)(stream)) {
|
|
163
164
|
return stream_1.Writable.fromWeb(stream);
|
|
164
165
|
}
|
|
165
166
|
return stream;
|
|
@@ -223,12 +224,13 @@ function finished(stream, optionsOrCallback, callback) {
|
|
|
223
224
|
const promise = new Promise((resolve, reject) => {
|
|
224
225
|
const normalizedStream = toNodePipelineStream(stream);
|
|
225
226
|
stream_1.finished(normalizedStream, options, (err) => {
|
|
226
|
-
|
|
227
|
+
// Node.js semantics: options.error defaults to true (report errors).
|
|
228
|
+
// If options.error === false, ignore errors and resolve.
|
|
229
|
+
if (err && options?.error !== false) {
|
|
227
230
|
reject(err);
|
|
231
|
+
return;
|
|
228
232
|
}
|
|
229
|
-
|
|
230
|
-
resolve();
|
|
231
|
-
}
|
|
233
|
+
resolve();
|
|
232
234
|
});
|
|
233
235
|
});
|
|
234
236
|
if (cb) {
|
|
@@ -455,41 +457,20 @@ function createCollector(options) {
|
|
|
455
457
|
// =============================================================================
|
|
456
458
|
// Pull Stream - Read data on demand with pattern matching
|
|
457
459
|
// =============================================================================
|
|
458
|
-
class PullStream extends pull_stream_1.PullStream {
|
|
459
|
-
}
|
|
460
|
-
exports.PullStream = PullStream;
|
|
461
460
|
/**
|
|
462
461
|
* Create a pull stream
|
|
463
462
|
*/
|
|
464
463
|
function createPullStream(options) {
|
|
465
|
-
return new PullStream(options);
|
|
464
|
+
return new pull_stream_1.PullStream(options);
|
|
466
465
|
}
|
|
467
466
|
// =============================================================================
|
|
468
467
|
// Buffered Stream - Efficient chunk management
|
|
469
468
|
// =============================================================================
|
|
470
|
-
/**
|
|
471
|
-
* String chunk implementation
|
|
472
|
-
*/
|
|
473
|
-
class StringChunk extends buffered_stream_1.StringChunk {
|
|
474
|
-
}
|
|
475
|
-
exports.StringChunk = StringChunk;
|
|
476
|
-
/**
|
|
477
|
-
* Buffer chunk implementation
|
|
478
|
-
*/
|
|
479
|
-
class BufferChunk extends buffered_stream_1.BufferChunk {
|
|
480
|
-
}
|
|
481
|
-
exports.BufferChunk = BufferChunk;
|
|
482
|
-
/**
|
|
483
|
-
* Buffered stream with efficient chunk management
|
|
484
|
-
*/
|
|
485
|
-
class BufferedStream extends buffered_stream_1.BufferedStream {
|
|
486
|
-
}
|
|
487
|
-
exports.BufferedStream = BufferedStream;
|
|
488
469
|
/**
|
|
489
470
|
* Create a buffered stream
|
|
490
471
|
*/
|
|
491
472
|
function createBufferedStream(options) {
|
|
492
|
-
return new BufferedStream(options);
|
|
473
|
+
return new buffered_stream_1.BufferedStream(options);
|
|
493
474
|
}
|
|
494
475
|
// =============================================================================
|
|
495
476
|
// Utility Functions
|
|
@@ -506,10 +487,10 @@ async function streamToPromise(stream) {
|
|
|
506
487
|
*/
|
|
507
488
|
async function streamToBuffer(stream) {
|
|
508
489
|
let iterable;
|
|
509
|
-
if (isReadableStream(stream)) {
|
|
490
|
+
if ((0, type_guards_1.isReadableStream)(stream)) {
|
|
510
491
|
iterable = stream_1.Readable.fromWeb(stream);
|
|
511
492
|
}
|
|
512
|
-
else if (isAsyncIterable(stream)) {
|
|
493
|
+
else if ((0, type_guards_1.isAsyncIterable)(stream)) {
|
|
513
494
|
iterable = stream;
|
|
514
495
|
}
|
|
515
496
|
else {
|
|
@@ -551,10 +532,10 @@ async function streamToString(stream, encoding) {
|
|
|
551
532
|
*/
|
|
552
533
|
async function drainStream(stream) {
|
|
553
534
|
let iterable;
|
|
554
|
-
if (isReadableStream(stream)) {
|
|
535
|
+
if ((0, type_guards_1.isReadableStream)(stream)) {
|
|
555
536
|
iterable = stream_1.Readable.fromWeb(stream);
|
|
556
537
|
}
|
|
557
|
-
else if (isAsyncIterable(stream)) {
|
|
538
|
+
else if ((0, type_guards_1.isAsyncIterable)(stream)) {
|
|
558
539
|
iterable = stream;
|
|
559
540
|
}
|
|
560
541
|
else {
|
|
@@ -581,13 +562,28 @@ function addAbortSignal(signal, stream) {
|
|
|
581
562
|
stream.destroy(new Error("Aborted"));
|
|
582
563
|
return stream;
|
|
583
564
|
}
|
|
565
|
+
const cleanup = () => {
|
|
566
|
+
signal.removeEventListener("abort", onAbort);
|
|
567
|
+
stream.off?.("close", onDone);
|
|
568
|
+
stream.off?.("end", onDone);
|
|
569
|
+
stream.off?.("finish", onDone);
|
|
570
|
+
stream.off?.("error", onError);
|
|
571
|
+
};
|
|
584
572
|
const onAbort = () => {
|
|
573
|
+
cleanup();
|
|
585
574
|
stream.destroy(new Error("Aborted"));
|
|
586
575
|
};
|
|
576
|
+
const onDone = () => {
|
|
577
|
+
cleanup();
|
|
578
|
+
};
|
|
579
|
+
const onError = () => {
|
|
580
|
+
cleanup();
|
|
581
|
+
};
|
|
587
582
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
588
|
-
stream.
|
|
589
|
-
|
|
590
|
-
|
|
583
|
+
stream.once?.("close", onDone);
|
|
584
|
+
stream.once?.("end", onDone);
|
|
585
|
+
stream.once?.("finish", onDone);
|
|
586
|
+
stream.once?.("error", onError);
|
|
591
587
|
return stream;
|
|
592
588
|
}
|
|
593
589
|
/**
|
|
@@ -630,56 +626,109 @@ function compose(...transforms) {
|
|
|
630
626
|
if (len === 1 && isNativeTransform(transforms[0])) {
|
|
631
627
|
return transforms[0];
|
|
632
628
|
}
|
|
633
|
-
// Chain all transforms together
|
|
629
|
+
// Chain all transforms together once.
|
|
634
630
|
for (let i = 0; i < len - 1; i++) {
|
|
635
631
|
transforms[i].pipe(transforms[i + 1]);
|
|
636
632
|
}
|
|
637
|
-
// Create a Duplex that writes to first and reads from last
|
|
638
633
|
const first = transforms[0];
|
|
639
634
|
const last = transforms[len - 1];
|
|
640
|
-
//
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
return first.write(chunk, encodingOrCallback);
|
|
635
|
+
// Use a private output stream so we don't have to monkey-patch `write()` on the
|
|
636
|
+
// public composed stream (which would break piping into it).
|
|
637
|
+
const output = new stream_1.PassThrough({ objectMode: last.readableObjectMode ?? true });
|
|
638
|
+
last.pipe(output);
|
|
639
|
+
let outputEnded = false;
|
|
640
|
+
const pumpOutput = (target) => {
|
|
641
|
+
if (outputEnded) {
|
|
642
|
+
return;
|
|
649
643
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
first.end(chunkOrCallback, encodingOrCallback);
|
|
644
|
+
while (true) {
|
|
645
|
+
const chunk = output.read();
|
|
646
|
+
if (chunk === null) {
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
if (!target.push(chunk)) {
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
659
652
|
}
|
|
660
|
-
|
|
661
|
-
|
|
653
|
+
};
|
|
654
|
+
const composed = new stream_1.Transform({
|
|
655
|
+
readableObjectMode: last.readableObjectMode,
|
|
656
|
+
writableObjectMode: first.writableObjectMode,
|
|
657
|
+
transform(chunk, encoding, callback) {
|
|
658
|
+
try {
|
|
659
|
+
// Forward writes into the head of the chain.
|
|
660
|
+
first.write(chunk, encoding, callback);
|
|
661
|
+
}
|
|
662
|
+
catch (err) {
|
|
663
|
+
callback(err);
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
flush(callback) {
|
|
667
|
+
// End the head of the chain; readable completion is driven by `output` ending.
|
|
668
|
+
const onFinish = () => {
|
|
669
|
+
cleanupFlush();
|
|
670
|
+
callback();
|
|
671
|
+
};
|
|
672
|
+
const onError = (err) => {
|
|
673
|
+
cleanupFlush();
|
|
674
|
+
callback(err);
|
|
675
|
+
};
|
|
676
|
+
const cleanupFlush = () => {
|
|
677
|
+
first.off?.("finish", onFinish);
|
|
678
|
+
first.off?.("error", onError);
|
|
679
|
+
};
|
|
680
|
+
first.once?.("finish", onFinish);
|
|
681
|
+
first.once?.("error", onError);
|
|
682
|
+
first.end();
|
|
683
|
+
},
|
|
684
|
+
read() {
|
|
685
|
+
pumpOutput(this);
|
|
686
|
+
},
|
|
687
|
+
destroy(err, callback) {
|
|
688
|
+
try {
|
|
689
|
+
output.destroy(err ?? undefined);
|
|
690
|
+
for (const t of transforms) {
|
|
691
|
+
t.destroy?.(err ?? undefined);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
finally {
|
|
695
|
+
callback(err);
|
|
696
|
+
}
|
|
662
697
|
}
|
|
663
|
-
|
|
698
|
+
});
|
|
699
|
+
const onOutputReadable = () => {
|
|
700
|
+
pumpOutput(composed);
|
|
664
701
|
};
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
702
|
+
const onOutputEnd = () => {
|
|
703
|
+
cleanupListeners();
|
|
704
|
+
outputEnded = true;
|
|
705
|
+
composed.push(null);
|
|
668
706
|
};
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
707
|
+
const onAnyError = (err) => {
|
|
708
|
+
cleanupListeners();
|
|
709
|
+
composed.destroy(err);
|
|
710
|
+
};
|
|
711
|
+
const transformErrorListeners = [];
|
|
712
|
+
const cleanupListeners = () => {
|
|
713
|
+
output.off("readable", onOutputReadable);
|
|
714
|
+
output.off("end", onOutputEnd);
|
|
715
|
+
output.off("error", onAnyError);
|
|
716
|
+
for (const { t, fn } of transformErrorListeners) {
|
|
717
|
+
t.off?.("error", fn);
|
|
718
|
+
}
|
|
719
|
+
transformErrorListeners.length = 0;
|
|
720
|
+
};
|
|
721
|
+
output.on("readable", onOutputReadable);
|
|
722
|
+
output.once("end", onOutputEnd);
|
|
723
|
+
output.once("error", onAnyError);
|
|
724
|
+
for (const t of transforms) {
|
|
725
|
+
const tt = t;
|
|
726
|
+
tt.once?.("error", onAnyError);
|
|
727
|
+
transformErrorListeners.push({ t: tt, fn: onAnyError });
|
|
682
728
|
}
|
|
729
|
+
composed.once("close", () => {
|
|
730
|
+
cleanupListeners();
|
|
731
|
+
});
|
|
683
732
|
return composed;
|
|
684
733
|
}
|
|
685
734
|
/**
|
|
@@ -760,7 +809,7 @@ function once(emitter, event, options) {
|
|
|
760
809
|
onAbort();
|
|
761
810
|
return;
|
|
762
811
|
}
|
|
763
|
-
options.signal.addEventListener("abort", onAbort);
|
|
812
|
+
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
764
813
|
}
|
|
765
814
|
});
|
|
766
815
|
}
|
|
@@ -28,46 +28,13 @@ async function collect(stream) {
|
|
|
28
28
|
return result;
|
|
29
29
|
}
|
|
30
30
|
async function text(stream) {
|
|
31
|
-
|
|
32
|
-
let totalLength = 0;
|
|
33
|
-
for await (const chunk of stream) {
|
|
34
|
-
chunks.push(chunk);
|
|
35
|
-
totalLength += chunk.length;
|
|
36
|
-
}
|
|
37
|
-
if (chunks.length === 1) {
|
|
38
|
-
return (0, shared_1.uint8ArrayToString)(chunks[0]);
|
|
39
|
-
}
|
|
40
|
-
const result = new Uint8Array(totalLength);
|
|
41
|
-
let offset = 0;
|
|
42
|
-
for (let i = 0, len = chunks.length; i < len; i++) {
|
|
43
|
-
const c = chunks[i];
|
|
44
|
-
result.set(c, offset);
|
|
45
|
-
offset += c.length;
|
|
46
|
-
}
|
|
47
|
-
return (0, shared_1.uint8ArrayToString)(result);
|
|
31
|
+
return streams_1.consumers.text(stream);
|
|
48
32
|
}
|
|
49
33
|
async function json(stream) {
|
|
50
|
-
|
|
51
|
-
return JSON.parse(str);
|
|
34
|
+
return streams_1.consumers.json(stream);
|
|
52
35
|
}
|
|
53
36
|
async function bytes(stream) {
|
|
54
|
-
|
|
55
|
-
let totalLength = 0;
|
|
56
|
-
for await (const chunk of stream) {
|
|
57
|
-
chunks.push(chunk);
|
|
58
|
-
totalLength += chunk.length;
|
|
59
|
-
}
|
|
60
|
-
if (chunks.length === 1) {
|
|
61
|
-
return chunks[0];
|
|
62
|
-
}
|
|
63
|
-
const result = new Uint8Array(totalLength);
|
|
64
|
-
let offset = 0;
|
|
65
|
-
for (let i = 0, len = chunks.length; i < len; i++) {
|
|
66
|
-
const c = chunks[i];
|
|
67
|
-
result.set(c, offset);
|
|
68
|
-
offset += c.length;
|
|
69
|
-
}
|
|
70
|
-
return result;
|
|
37
|
+
return streams_1.consumers.buffer(stream);
|
|
71
38
|
}
|
|
72
39
|
// =============================================================================
|
|
73
40
|
// Stream Factory Helpers
|
|
@@ -39,3 +39,15 @@ export { CsvParserStream, CsvFormatterStream } from "./modules/csv/csv.browser.j
|
|
|
39
39
|
// Utilities
|
|
40
40
|
// =============================================================================
|
|
41
41
|
export * from "./modules/excel/utils/sheet-utils.js";
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// Archive (ZIP) support (Browser-compatible)
|
|
44
|
+
// =============================================================================
|
|
45
|
+
export {
|
|
46
|
+
// High-level archive API
|
|
47
|
+
zip, unzip, ZipArchive, ZipReader, UnzipEntry,
|
|
48
|
+
// CRC32
|
|
49
|
+
crc32, crc32Update, crc32Finalize,
|
|
50
|
+
// Compression utilities
|
|
51
|
+
compress, compressSync, decompress, decompressSync, hasCompressionStream,
|
|
52
|
+
// Streaming compression
|
|
53
|
+
createDeflateStream, createInflateStream, hasDeflateRaw } from "./modules/archive/index.browser.js";
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
* Browser fallback: For browsers without deflate-raw support (Firefox < 113, Safari < 16.4),
|
|
9
9
|
* see deflate-fallback.ts for pure JS implementation
|
|
10
10
|
*/
|
|
11
|
-
import { ByteQueue } from "
|
|
11
|
+
import { ByteQueue } from "../internal/byte-queue.js";
|
|
12
12
|
/**
|
|
13
13
|
* Default threshold (in bytes) to choose the lower-overhead path.
|
|
14
14
|
*
|
|
15
15
|
* This is a performance knob, not a correctness requirement.
|
|
16
|
+
* Default: 8MB.
|
|
16
17
|
*/
|
|
17
18
|
export const DEFAULT_COMPRESS_THRESHOLD_BYTES = 8 * 1024 * 1024;
|
|
18
19
|
/**
|
package/dist/{browser/modules/archive → esm/modules/archive/compression}/compress.browser.js
RENAMED
|
@@ -10,23 +10,18 @@
|
|
|
10
10
|
* - Safari >= 14.1
|
|
11
11
|
* - Edge >= 89
|
|
12
12
|
*/
|
|
13
|
-
import { compressWithStream, decompressWithStream, hasDeflateRawCompressionStream, hasDeflateRawDecompressionStream
|
|
13
|
+
import { compressWithStream, decompressWithStream, hasCompressionStream, hasDeflateRawCompressionStream, hasDeflateRawDecompressionStream } from "./compress.base.js";
|
|
14
14
|
import { inflateRaw, deflateRawCompressed } from "./deflate-fallback.js";
|
|
15
|
-
import { DEFAULT_COMPRESS_LEVEL } from "
|
|
15
|
+
import { DEFAULT_COMPRESS_LEVEL } from "../defaults.js";
|
|
16
16
|
// Re-export shared types
|
|
17
17
|
export {};
|
|
18
|
-
|
|
19
|
-
* Check if CompressionStream is available in this environment.
|
|
20
|
-
*
|
|
21
|
-
* Note: Some environments may expose CompressionStream but not support
|
|
22
|
-
* the "deflate-raw" format that ZIP requires.
|
|
23
|
-
*/
|
|
24
|
-
export function hasCompressionStream() {
|
|
25
|
-
return typeof CompressionStream !== "undefined";
|
|
26
|
-
}
|
|
18
|
+
export { hasCompressionStream };
|
|
27
19
|
/**
|
|
28
20
|
* Compress data using browser's native CompressionStream or JS fallback
|
|
29
21
|
*
|
|
22
|
+
* Note: We always prefer native CompressionStream when available because
|
|
23
|
+
* it's significantly faster than pure JS implementation.
|
|
24
|
+
*
|
|
30
25
|
* @param data - Data to compress
|
|
31
26
|
* @param options - Compression options
|
|
32
27
|
* @returns Compressed data
|
|
@@ -39,16 +34,15 @@ export function hasCompressionStream() {
|
|
|
39
34
|
*/
|
|
40
35
|
export async function compress(data, options = {}) {
|
|
41
36
|
const level = options.level ?? DEFAULT_COMPRESS_LEVEL;
|
|
42
|
-
const thresholdBytes = resolveCompressThresholdBytes(options);
|
|
43
37
|
// Level 0 means no compression
|
|
44
38
|
if (level === 0) {
|
|
45
39
|
return data;
|
|
46
40
|
}
|
|
47
|
-
//
|
|
48
|
-
if (hasDeflateRawCompressionStream()
|
|
41
|
+
// Always use native CompressionStream when available - it's much faster than JS
|
|
42
|
+
if (hasDeflateRawCompressionStream()) {
|
|
49
43
|
return compressWithStream(data);
|
|
50
44
|
}
|
|
51
|
-
// Fallback to pure JS implementation
|
|
45
|
+
// Fallback to pure JS implementation only when native is unavailable
|
|
52
46
|
return deflateRawCompressed(data);
|
|
53
47
|
}
|
|
54
48
|
/**
|
|
@@ -70,16 +64,21 @@ export function compressSync(data, options = {}) {
|
|
|
70
64
|
/**
|
|
71
65
|
* Decompress data using browser's native DecompressionStream or JS fallback
|
|
72
66
|
*
|
|
67
|
+
* Note: We always prefer native DecompressionStream when available because
|
|
68
|
+
* it's significantly faster than pure JS implementation, regardless of data size.
|
|
69
|
+
* The threshold is only useful for compression where the overhead matters more.
|
|
70
|
+
*
|
|
73
71
|
* @param data - Compressed data (deflate-raw format)
|
|
72
|
+
* @param options - Decompression options (kept for API parity; currently unused in browser)
|
|
74
73
|
* @returns Decompressed data
|
|
75
74
|
*/
|
|
76
75
|
export async function decompress(data, options = {}) {
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
if (hasDeflateRawDecompressionStream()
|
|
76
|
+
void options;
|
|
77
|
+
// Always use native DecompressionStream when available - it's much faster than JS
|
|
78
|
+
if (hasDeflateRawDecompressionStream()) {
|
|
80
79
|
return decompressWithStream(data);
|
|
81
80
|
}
|
|
82
|
-
// Fallback to pure JS implementation
|
|
81
|
+
// Fallback to pure JS implementation only when native is unavailable
|
|
83
82
|
return inflateRaw(data);
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { promisify } from "util";
|
|
8
8
|
import * as zlib from "zlib";
|
|
9
|
-
import { DEFAULT_COMPRESS_LEVEL } from "
|
|
9
|
+
import { DEFAULT_COMPRESS_LEVEL } from "../defaults.js";
|
|
10
10
|
// Re-export shared types and utilities
|
|
11
11
|
export { hasCompressionStream } from "./compress.base.js";
|
|
12
12
|
function uint8ArrayToBufferView(data) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
|
|
9
9
|
* Represented as 0xEDB88320 in reversed (LSB-first) form
|
|
10
10
|
*/
|
|
11
|
-
import { isNode } from "
|
|
11
|
+
import { isNode } from "../../../utils/env.js";
|
|
12
12
|
import { crc32JS, crc32UpdateJS, crc32Finalize } from "./crc32.base.js";
|
|
13
13
|
// Lazy-loaded zlib module for Node.js
|
|
14
14
|
let _zlib = null;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - Safari < 16.4
|
|
11
11
|
* - Chrome < 103
|
|
12
12
|
*/
|
|
13
|
-
import { concatUint8Arrays } from "
|
|
13
|
+
import { concatUint8Arrays } from "../utils/bytes.js";
|
|
14
14
|
// ============================================================================
|
|
15
15
|
// DEFLATE Decompression (Full implementation)
|
|
16
16
|
// ============================================================================
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* API compatible with Node.js version - supports .on("data"), .on("end"), .write(callback), .end()
|
|
8
8
|
*/
|
|
9
|
-
import { EventEmitter } from "
|
|
9
|
+
import { EventEmitter } from "../../stream/index.js";
|
|
10
10
|
import { deflateRawCompressed, inflateRaw } from "./deflate-fallback.js";
|
|
11
11
|
import { hasDeflateRawWebStreams } from "./compress.base.js";
|
|
12
|
-
import { concatUint8Arrays } from "
|
|
13
|
-
import { DEFAULT_COMPRESS_LEVEL } from "
|
|
12
|
+
import { concatUint8Arrays } from "../utils/bytes.js";
|
|
13
|
+
import { DEFAULT_COMPRESS_LEVEL } from "../defaults.js";
|
|
14
14
|
import { asError } from "./streaming-compress.base.js";
|
|
15
15
|
/**
|
|
16
16
|
* Check if deflate-raw streaming compression is supported by this library.
|
package/dist/esm/modules/archive/{streaming-compress.js → compression/streaming-compress.js}
RENAMED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Each write() immediately produces compressed output without waiting for end().
|
|
6
6
|
*/
|
|
7
7
|
import { createDeflateRaw, createInflateRaw, constants } from "zlib";
|
|
8
|
-
import { Transform } from "
|
|
9
|
-
import { DEFAULT_COMPRESS_LEVEL } from "
|
|
8
|
+
import { Transform } from "../../stream/index.js";
|
|
9
|
+
import { DEFAULT_COMPRESS_LEVEL } from "../defaults.js";
|
|
10
10
|
/**
|
|
11
11
|
* Wrapper around zlib DeflateRaw that flushes after every write
|
|
12
12
|
* This ensures true streaming behavior - data is emitted immediately, not buffered
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
export const
|
|
1
|
+
export const DEFAULT_DEFLATE_LEVEL = 6;
|
|
2
|
+
// Backward-compatible aliases (avoid default drift across modules).
|
|
3
|
+
export const DEFAULT_COMPRESS_LEVEL = DEFAULT_DEFLATE_LEVEL;
|
|
4
|
+
export const DEFAULT_ZIP_LEVEL = DEFAULT_DEFLATE_LEVEL;
|
|
5
|
+
// Prefer reproducible output by default: omit the Info-ZIP UTC mtime extra field.
|
|
6
|
+
export const DEFAULT_ZIP_TIMESTAMPS = "dos";
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
* Platform-specific entrypoints (index.ts / index.browser.ts) should re-export
|
|
6
6
|
* from this file and then layer their platform-specific bindings.
|
|
7
7
|
*/
|
|
8
|
-
//
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export { StreamingZip, ZipDeflateFile, Zip, ZipDeflate } from "./streaming-zip.js";
|
|
12
|
-
// Buffer-based unzip API (cross-platform)
|
|
13
|
-
export { extractAll, extractFile, listFiles, forEachEntry, ZipParser } from "./extract.js";
|
|
8
|
+
// High-level APIs
|
|
9
|
+
export { zip, ZipArchive } from "./zip/index.js";
|
|
10
|
+
export { unzip, ZipReader, UnzipEntry } from "./unzip/index.js";
|