7z-iterator 1.4.0 → 2.0.0
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/dist/cjs/index.d.cts +3 -3
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +7 -38
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/nextEntry.js +1 -2
- package/dist/cjs/nextEntry.js.map +1 -1
- package/dist/cjs/sevenz/codecs/index.js +52 -30
- package/dist/cjs/sevenz/codecs/index.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/nextEntry.js +1 -2
- package/dist/esm/nextEntry.js.map +1 -1
- package/dist/esm/sevenz/codecs/index.js +32 -10
- package/dist/esm/sevenz/codecs/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/lzma/Lzma2ChunkParser.d.cts +0 -73
- package/dist/cjs/lzma/Lzma2ChunkParser.d.ts +0 -73
- package/dist/cjs/lzma/Lzma2ChunkParser.js +0 -148
- package/dist/cjs/lzma/Lzma2ChunkParser.js.map +0 -1
- package/dist/cjs/lzma/index.d.cts +0 -31
- package/dist/cjs/lzma/index.d.ts +0 -31
- package/dist/cjs/lzma/index.js +0 -83
- package/dist/cjs/lzma/index.js.map +0 -1
- package/dist/cjs/lzma/stream/transforms.d.cts +0 -46
- package/dist/cjs/lzma/stream/transforms.d.ts +0 -46
- package/dist/cjs/lzma/stream/transforms.js +0 -209
- package/dist/cjs/lzma/stream/transforms.js.map +0 -1
- package/dist/cjs/lzma/sync/Lzma2Decoder.d.cts +0 -63
- package/dist/cjs/lzma/sync/Lzma2Decoder.d.ts +0 -63
- package/dist/cjs/lzma/sync/Lzma2Decoder.js +0 -231
- package/dist/cjs/lzma/sync/Lzma2Decoder.js.map +0 -1
- package/dist/cjs/lzma/sync/LzmaDecoder.d.cts +0 -97
- package/dist/cjs/lzma/sync/LzmaDecoder.d.ts +0 -97
- package/dist/cjs/lzma/sync/LzmaDecoder.js +0 -580
- package/dist/cjs/lzma/sync/LzmaDecoder.js.map +0 -1
- package/dist/cjs/lzma/sync/RangeDecoder.d.cts +0 -69
- package/dist/cjs/lzma/sync/RangeDecoder.d.ts +0 -69
- package/dist/cjs/lzma/sync/RangeDecoder.js +0 -162
- package/dist/cjs/lzma/sync/RangeDecoder.js.map +0 -1
- package/dist/cjs/lzma/types.d.cts +0 -117
- package/dist/cjs/lzma/types.d.ts +0 -117
- package/dist/cjs/lzma/types.js +0 -264
- package/dist/cjs/lzma/types.js.map +0 -1
- package/dist/cjs/sevenz/codecs/Bcj.d.cts +0 -16
- package/dist/cjs/sevenz/codecs/Bcj.d.ts +0 -16
- package/dist/cjs/sevenz/codecs/Bcj.js +0 -183
- package/dist/cjs/sevenz/codecs/Bcj.js.map +0 -1
- package/dist/cjs/sevenz/codecs/BcjArm.d.cts +0 -21
- package/dist/cjs/sevenz/codecs/BcjArm.d.ts +0 -21
- package/dist/cjs/sevenz/codecs/BcjArm.js +0 -104
- package/dist/cjs/sevenz/codecs/BcjArm.js.map +0 -1
- package/dist/cjs/sevenz/codecs/BcjArm64.d.cts +0 -21
- package/dist/cjs/sevenz/codecs/BcjArm64.d.ts +0 -21
- package/dist/cjs/sevenz/codecs/BcjArm64.js +0 -65
- package/dist/cjs/sevenz/codecs/BcjArm64.js.map +0 -1
- package/dist/cjs/sevenz/codecs/BcjArmt.d.cts +0 -19
- package/dist/cjs/sevenz/codecs/BcjArmt.d.ts +0 -19
- package/dist/cjs/sevenz/codecs/BcjArmt.js +0 -76
- package/dist/cjs/sevenz/codecs/BcjArmt.js.map +0 -1
- package/dist/cjs/sevenz/codecs/BcjIa64.d.cts +0 -15
- package/dist/cjs/sevenz/codecs/BcjIa64.d.ts +0 -15
- package/dist/cjs/sevenz/codecs/BcjIa64.js +0 -141
- package/dist/cjs/sevenz/codecs/BcjIa64.js.map +0 -1
- package/dist/cjs/sevenz/codecs/BcjPpc.d.cts +0 -20
- package/dist/cjs/sevenz/codecs/BcjPpc.d.ts +0 -20
- package/dist/cjs/sevenz/codecs/BcjPpc.js +0 -64
- package/dist/cjs/sevenz/codecs/BcjPpc.js.map +0 -1
- package/dist/cjs/sevenz/codecs/BcjSparc.d.cts +0 -19
- package/dist/cjs/sevenz/codecs/BcjSparc.d.ts +0 -19
- package/dist/cjs/sevenz/codecs/BcjSparc.js +0 -69
- package/dist/cjs/sevenz/codecs/BcjSparc.js.map +0 -1
- package/dist/cjs/sevenz/codecs/Delta.d.cts +0 -16
- package/dist/cjs/sevenz/codecs/Delta.d.ts +0 -16
- package/dist/cjs/sevenz/codecs/Delta.js +0 -74
- package/dist/cjs/sevenz/codecs/Delta.js.map +0 -1
- package/dist/cjs/sevenz/codecs/Lzma.d.cts +0 -17
- package/dist/cjs/sevenz/codecs/Lzma.d.ts +0 -17
- package/dist/cjs/sevenz/codecs/Lzma.js +0 -40
- package/dist/cjs/sevenz/codecs/Lzma.js.map +0 -1
- package/dist/cjs/sevenz/codecs/Lzma2.d.cts +0 -20
- package/dist/cjs/sevenz/codecs/Lzma2.d.ts +0 -20
- package/dist/cjs/sevenz/codecs/Lzma2.js +0 -42
- package/dist/cjs/sevenz/codecs/Lzma2.js.map +0 -1
- package/dist/cjs/xz/Decoder.d.cts +0 -25
- package/dist/cjs/xz/Decoder.d.ts +0 -25
- package/dist/cjs/xz/Decoder.js +0 -194
- package/dist/cjs/xz/Decoder.js.map +0 -1
- package/dist/esm/lzma/Lzma2ChunkParser.d.ts +0 -73
- package/dist/esm/lzma/Lzma2ChunkParser.js +0 -137
- package/dist/esm/lzma/Lzma2ChunkParser.js.map +0 -1
- package/dist/esm/lzma/index.d.ts +0 -31
- package/dist/esm/lzma/index.js +0 -44
- package/dist/esm/lzma/index.js.map +0 -1
- package/dist/esm/lzma/stream/transforms.d.ts +0 -46
- package/dist/esm/lzma/stream/transforms.js +0 -189
- package/dist/esm/lzma/stream/transforms.js.map +0 -1
- package/dist/esm/lzma/sync/Lzma2Decoder.d.ts +0 -63
- package/dist/esm/lzma/sync/Lzma2Decoder.js +0 -211
- package/dist/esm/lzma/sync/Lzma2Decoder.js.map +0 -1
- package/dist/esm/lzma/sync/LzmaDecoder.d.ts +0 -97
- package/dist/esm/lzma/sync/LzmaDecoder.js +0 -543
- package/dist/esm/lzma/sync/LzmaDecoder.js.map +0 -1
- package/dist/esm/lzma/sync/RangeDecoder.d.ts +0 -69
- package/dist/esm/lzma/sync/RangeDecoder.js +0 -132
- package/dist/esm/lzma/sync/RangeDecoder.js.map +0 -1
- package/dist/esm/lzma/types.d.ts +0 -117
- package/dist/esm/lzma/types.js +0 -154
- package/dist/esm/lzma/types.js.map +0 -1
- package/dist/esm/sevenz/codecs/Bcj.d.ts +0 -16
- package/dist/esm/sevenz/codecs/Bcj.js +0 -175
- package/dist/esm/sevenz/codecs/Bcj.js.map +0 -1
- package/dist/esm/sevenz/codecs/BcjArm.d.ts +0 -21
- package/dist/esm/sevenz/codecs/BcjArm.js +0 -101
- package/dist/esm/sevenz/codecs/BcjArm.js.map +0 -1
- package/dist/esm/sevenz/codecs/BcjArm64.d.ts +0 -21
- package/dist/esm/sevenz/codecs/BcjArm64.js +0 -57
- package/dist/esm/sevenz/codecs/BcjArm64.js.map +0 -1
- package/dist/esm/sevenz/codecs/BcjArmt.d.ts +0 -19
- package/dist/esm/sevenz/codecs/BcjArmt.js +0 -66
- package/dist/esm/sevenz/codecs/BcjArmt.js.map +0 -1
- package/dist/esm/sevenz/codecs/BcjIa64.d.ts +0 -15
- package/dist/esm/sevenz/codecs/BcjIa64.js +0 -127
- package/dist/esm/sevenz/codecs/BcjIa64.js.map +0 -1
- package/dist/esm/sevenz/codecs/BcjPpc.d.ts +0 -20
- package/dist/esm/sevenz/codecs/BcjPpc.js +0 -55
- package/dist/esm/sevenz/codecs/BcjPpc.js.map +0 -1
- package/dist/esm/sevenz/codecs/BcjSparc.d.ts +0 -19
- package/dist/esm/sevenz/codecs/BcjSparc.js +0 -59
- package/dist/esm/sevenz/codecs/BcjSparc.js.map +0 -1
- package/dist/esm/sevenz/codecs/Delta.d.ts +0 -16
- package/dist/esm/sevenz/codecs/Delta.js +0 -66
- package/dist/esm/sevenz/codecs/Delta.js.map +0 -1
- package/dist/esm/sevenz/codecs/Lzma.d.ts +0 -17
- package/dist/esm/sevenz/codecs/Lzma.js +0 -33
- package/dist/esm/sevenz/codecs/Lzma.js.map +0 -1
- package/dist/esm/sevenz/codecs/Lzma2.d.ts +0 -20
- package/dist/esm/sevenz/codecs/Lzma2.js +0 -38
- package/dist/esm/sevenz/codecs/Lzma2.js.map +0 -1
- package/dist/esm/xz/Decoder.d.ts +0 -25
- package/dist/esm/xz/Decoder.js +0 -185
- package/dist/esm/xz/Decoder.js.map +0 -1
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './FileEntry.js';
|
|
2
|
+
export * from './nextEntry.js';
|
|
3
3
|
export { default } from './SevenZipIterator.js';
|
|
4
|
+
export * from './sevenz/index.js';
|
|
4
5
|
export * from './types.js';
|
|
5
|
-
export { createXZDecoder, decodeXZ } from './xz/Decoder.js';
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './FileEntry.js';
|
|
2
|
+
export * from './nextEntry.js';
|
|
3
3
|
export { default } from './SevenZipIterator.js';
|
|
4
|
+
export * from './sevenz/index.js';
|
|
4
5
|
export * from './types.js';
|
|
5
|
-
export { createXZDecoder, decodeXZ } from './xz/Decoder.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,50 +1,19 @@
|
|
|
1
|
-
//
|
|
1
|
+
// 7z-iterator - high-level 7z archive iterator
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
get Lzma2Decoder () {
|
|
14
|
-
return _indexts.Lzma2Decoder;
|
|
15
|
-
},
|
|
16
|
-
get LzmaDecoder () {
|
|
17
|
-
return _indexts.LzmaDecoder;
|
|
18
|
-
},
|
|
19
|
-
get createLzma2Decoder () {
|
|
20
|
-
return _indexts.createLzma2Decoder;
|
|
21
|
-
},
|
|
22
|
-
get createLzmaDecoder () {
|
|
23
|
-
return _indexts.createLzmaDecoder;
|
|
24
|
-
},
|
|
25
|
-
get createXZDecoder () {
|
|
26
|
-
return _Decoderts.createXZDecoder;
|
|
27
|
-
},
|
|
28
|
-
get decodeLzma () {
|
|
29
|
-
return _indexts.decodeLzma;
|
|
30
|
-
},
|
|
31
|
-
get decodeLzma2 () {
|
|
32
|
-
return _indexts.decodeLzma2;
|
|
33
|
-
},
|
|
34
|
-
get decodeXZ () {
|
|
35
|
-
return _Decoderts.decodeXZ;
|
|
36
|
-
},
|
|
37
|
-
get default () {
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
38
9
|
return _SevenZipIteratorts.default;
|
|
39
|
-
},
|
|
40
|
-
get detectFormat () {
|
|
41
|
-
return _indexts.detectFormat;
|
|
42
10
|
}
|
|
43
11
|
});
|
|
44
|
-
|
|
12
|
+
_export_star(require("./FileEntry.js"), exports);
|
|
13
|
+
_export_star(require("./nextEntry.js"), exports);
|
|
45
14
|
var _SevenZipIteratorts = /*#__PURE__*/ _interop_require_default(require("./SevenZipIterator.js"));
|
|
15
|
+
_export_star(require("./sevenz/index.js"), exports);
|
|
46
16
|
_export_star(require("./types.js"), exports);
|
|
47
|
-
var _Decoderts = require("./xz/Decoder.js");
|
|
48
17
|
function _export_star(from, to) {
|
|
49
18
|
Object.keys(from).forEach(function(k) {
|
|
50
19
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/index.ts"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/index.ts"],"sourcesContent":["// 7z-iterator - high-level 7z archive iterator\n\nexport * from './FileEntry.ts';\nexport * from './nextEntry.ts';\nexport { default } from './SevenZipIterator.ts';\nexport * from './sevenz/index.ts';\nexport * from './types.ts';\n"],"names":["default"],"mappings":"AAAA,+CAA+C;;;;;+BAItCA;;;eAAAA,2BAAO;;;qBAFF;qBACA;yEACU;qBACV;qBACA"}
|
package/dist/cjs/nextEntry.js
CHANGED
|
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
var _calloncefn = /*#__PURE__*/ _interop_require_default(require("call-once-fn"));
|
|
12
12
|
var _extractbaseiterator = require("extract-base-iterator");
|
|
13
|
-
var _lodashcompact = /*#__PURE__*/ _interop_require_default(require("lodash.compact"));
|
|
14
13
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
15
14
|
var _FileEntryts = /*#__PURE__*/ _interop_require_default(require("./FileEntry.js"));
|
|
16
15
|
function _interop_require_default(obj) {
|
|
@@ -56,7 +55,7 @@ function nextEntry(iterator, callback) {
|
|
|
56
55
|
// mtime must be timestamp (number) for FileAttributes compatibility
|
|
57
56
|
var mtimeDate = entry.mtime || new Date();
|
|
58
57
|
var attributes = {
|
|
59
|
-
path:
|
|
58
|
+
path: entry.path.split(_path.default.sep).filter(Boolean).join(_path.default.sep),
|
|
60
59
|
basename: entry.name,
|
|
61
60
|
mtime: mtimeDate.getTime(),
|
|
62
61
|
mode: entry.mode !== undefined ? entry.mode : defaultMode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type DirectoryAttributes, DirectoryEntry, type FileAttributes, type LinkAttributes, SymbolicLinkEntry } from 'extract-base-iterator';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type DirectoryAttributes, DirectoryEntry, type FileAttributes, type LinkAttributes, SymbolicLinkEntry } from 'extract-base-iterator';\nimport path from 'path';\nimport FileEntry from './FileEntry.ts';\nimport type SevenZipIterator from './SevenZipIterator.ts';\nimport type { SevenZipEntry, SevenZipParser } from './sevenz/SevenZipParser.ts';\nimport type { Entry, EntryCallback } from './types.ts';\n\nexport type NextCallback = (error?: Error, entry?: Entry) => void;\n\n/** @internal */\ninterface InternalIterator {\n next(): SevenZipEntry | null;\n getParser(): SevenZipParser;\n}\n\n// Entry attributes object that gets mutated in switch - union of possible shapes\n// mtime is number for FileAttributes compatibility (timestamp in ms)\ntype EntryAttributesBuilder = {\n path: string;\n basename: string;\n mtime: number;\n mode: number;\n type?: 'file' | 'directory';\n size?: number;\n};\n\nexport default function nextEntry<_T>(iterator: SevenZipIterator, callback: EntryCallback): void {\n const internalIter = iterator._iterator as InternalIterator | null;\n if (!internalIter) {\n callback(new Error('iterator missing'));\n return;\n }\n\n let entry: SevenZipEntry | null = null;\n entry = internalIter.next();\n\n const nextCallback = once((err?: Error, entry?: Entry) => {\n // keep processing\n if (entry) iterator.push(nextEntry);\n err ? callback(err) : callback(null, entry ? { done: false, value: entry } : { done: true, value: null });\n }) as NextCallback;\n\n // done: signal iteration is complete (guard against stale lock)\n if (!iterator.lock || iterator.isDone() || !entry) return callback(null, { done: true, value: null });\n\n // Skip anti-files (these mark files to delete in delta archives)\n if (entry.isAntiFile) {\n iterator.push(nextEntry);\n return callback(null, null);\n }\n\n // Determine type from entry\n const type = entry.type;\n\n // Default modes (decimal values for Node 0.8 compatibility)\n // 0o755 = 493, 0o644 = 420\n const defaultMode = type === 'directory' ? 493 : 420;\n\n // Build attributes from 7z entry\n // mtime must be timestamp (number) for FileAttributes compatibility\n const mtimeDate = entry.mtime || new Date();\n const attributes: EntryAttributesBuilder = {\n path: entry.path.split(path.sep).filter(Boolean).join(path.sep),\n basename: entry.name,\n mtime: mtimeDate.getTime(),\n mode: entry.mode !== undefined ? entry.mode : defaultMode,\n };\n\n switch (type) {\n case 'directory':\n attributes.type = 'directory';\n return nextCallback(null, new DirectoryEntry(attributes as DirectoryAttributes));\n\n case 'link': {\n // For symlinks, the file content IS the symlink target path\n // Read the content to get the linkpath for SymbolicLinkEntry\n const parser = internalIter.getParser();\n const stream = parser.getEntryStream(entry);\n\n const chunks: Buffer[] = [];\n\n stream.on('data', (chunk: Buffer) => {\n chunks.push(chunk);\n });\n stream.on('end', () => {\n const linkpath = Buffer.concat(chunks).toString('utf8');\n\n const linkAttributes: LinkAttributes = {\n path: attributes.path,\n mtime: attributes.mtime,\n mode: attributes.mode,\n linkpath: linkpath,\n };\n\n nextCallback(null, new SymbolicLinkEntry(linkAttributes));\n });\n stream.on('error', (streamErr: Error) => {\n nextCallback(streamErr);\n });\n return;\n }\n\n case 'file': {\n attributes.type = 'file';\n attributes.size = entry.size;\n const parser = internalIter.getParser();\n\n const stream = parser.getEntryStream(entry);\n return nextCallback(null, new FileEntry(attributes as FileAttributes, stream, iterator.lock, entry._canStream));\n }\n }\n\n return callback(new Error(`Unrecognized entry type: ${type}`));\n}\n"],"names":["nextEntry","iterator","callback","internalIter","_iterator","Error","entry","next","nextCallback","once","err","push","done","value","lock","isDone","isAntiFile","type","defaultMode","mtimeDate","mtime","Date","attributes","path","split","sep","filter","Boolean","join","basename","name","getTime","mode","undefined","DirectoryEntry","parser","getParser","stream","getEntryStream","chunks","on","chunk","linkpath","Buffer","concat","toString","linkAttributes","SymbolicLinkEntry","streamErr","size","FileEntry","_canStream"],"mappings":";;;;+BA2BA;;;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OAAOT,aAAa,MAAM,IAAI0B,mCAAc,CAACZ;QAE/C,KAAK;YAAQ;gBACX,4DAA4D;gBAC5D,6DAA6D;gBAC7D,IAAMa,SAAShC,aAAaiC,SAAS;gBACrC,IAAMC,SAASF,OAAOG,cAAc,CAAChC;gBAErC,IAAMiC,SAAmB,EAAE;gBAE3BF,OAAOG,EAAE,CAAC,QAAQ,SAACC;oBACjBF,OAAO5B,IAAI,CAAC8B;gBACd;gBACAJ,OAAOG,EAAE,CAAC,OAAO;oBACf,IAAME,WAAWC,OAAOC,MAAM,CAACL,QAAQM,QAAQ,CAAC;oBAEhD,IAAMC,iBAAiC;wBACrCvB,MAAMD,WAAWC,IAAI;wBACrBH,OAAOE,WAAWF,KAAK;wBACvBY,MAAMV,WAAWU,IAAI;wBACrBU,UAAUA;oBACZ;oBAEAlC,aAAa,MAAM,IAAIuC,sCAAiB,CAACD;gBAC3C;gBACAT,OAAOG,EAAE,CAAC,SAAS,SAACQ;oBAClBxC,aAAawC;gBACf;gBACA;YACF;QAEA,KAAK;YAAQ;gBACX1B,WAAWL,IAAI,GAAG;gBAClBK,WAAW2B,IAAI,GAAG3C,MAAM2C,IAAI;gBAC5B,IAAMd,UAAShC,aAAaiC,SAAS;gBAErC,IAAMC,UAASF,QAAOG,cAAc,CAAChC;gBACrC,OAAOE,aAAa,MAAM,IAAI0C,oBAAS,CAAC5B,YAA8Be,SAAQpC,SAASa,IAAI,EAAER,MAAM6C,UAAU;YAC/G;IACF;IAEA,OAAOjD,SAAS,IAAIG,MAAM,AAAC,4BAAgC,OAALY;AACxD"}
|
|
@@ -36,22 +36,44 @@ _export(exports, {
|
|
|
36
36
|
return _Aests.setPassword;
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
+
var _xzcompat = require("xz-compat");
|
|
39
40
|
var _constantsts = require("../constants.js");
|
|
40
41
|
var _Aests = require("./Aes.js");
|
|
41
|
-
var _Bcjts = require("./Bcj.js");
|
|
42
42
|
var _Bcj2ts = require("./Bcj2.js");
|
|
43
|
-
var _BcjArmts = require("./BcjArm.js");
|
|
44
|
-
var _BcjArm64ts = require("./BcjArm64.js");
|
|
45
|
-
var _BcjArmtts = require("./BcjArmt.js");
|
|
46
|
-
var _BcjIa64ts = require("./BcjIa64.js");
|
|
47
|
-
var _BcjPpcts = require("./BcjPpc.js");
|
|
48
|
-
var _BcjSparcts = require("./BcjSparc.js");
|
|
49
43
|
var _BZip2ts = require("./BZip2.js");
|
|
50
44
|
var _Copyts = require("./Copy.js");
|
|
51
45
|
var _Deflatets = require("./Deflate.js");
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
// Simple wrappers with validation that use xz-compat's optimized decode7zLjma/decode7zLzma2
|
|
47
|
+
function decodeLzma(input, properties, unpackSize) {
|
|
48
|
+
if (!properties || properties.length < 5) {
|
|
49
|
+
throw new Error('LZMA requires 5-byte properties');
|
|
50
|
+
}
|
|
51
|
+
if (typeof unpackSize !== 'number' || unpackSize < 0) {
|
|
52
|
+
throw new Error('LZMA requires known unpack size');
|
|
53
|
+
}
|
|
54
|
+
return (0, _xzcompat.decode7zLzma)(input, properties, unpackSize);
|
|
55
|
+
}
|
|
56
|
+
function createLzmaDecoder(properties, unpackSize) {
|
|
57
|
+
if (!properties || properties.length < 5) {
|
|
58
|
+
throw new Error('LZMA requires 5-byte properties');
|
|
59
|
+
}
|
|
60
|
+
if (typeof unpackSize !== 'number' || unpackSize < 0) {
|
|
61
|
+
throw new Error('LZMA requires known unpack size');
|
|
62
|
+
}
|
|
63
|
+
return (0, _xzcompat.createLzmaDecoder)(properties, unpackSize);
|
|
64
|
+
}
|
|
65
|
+
function decodeLzma2(input, properties, unpackSize) {
|
|
66
|
+
if (!properties || properties.length < 1) {
|
|
67
|
+
throw new Error('LZMA2 requires properties byte');
|
|
68
|
+
}
|
|
69
|
+
return (0, _xzcompat.decode7zLzma2)(input, properties, unpackSize);
|
|
70
|
+
}
|
|
71
|
+
function createLzma2Decoder(properties, _unpackSize) {
|
|
72
|
+
if (!properties || properties.length < 1) {
|
|
73
|
+
throw new Error('LZMA2 requires properties byte');
|
|
74
|
+
}
|
|
75
|
+
return (0, _xzcompat.createLzma2Decoder)(properties);
|
|
76
|
+
}
|
|
55
77
|
// Registry of supported codecs
|
|
56
78
|
var codecs = {};
|
|
57
79
|
/**
|
|
@@ -116,53 +138,53 @@ registerCodec(_constantsts.CodecId.COPY, {
|
|
|
116
138
|
});
|
|
117
139
|
// LZMA codec
|
|
118
140
|
registerCodec(_constantsts.CodecId.LZMA, {
|
|
119
|
-
decode:
|
|
120
|
-
createDecoder:
|
|
141
|
+
decode: decodeLzma,
|
|
142
|
+
createDecoder: createLzmaDecoder
|
|
121
143
|
});
|
|
122
144
|
// LZMA2 codec
|
|
123
145
|
registerCodec(_constantsts.CodecId.LZMA2, {
|
|
124
|
-
decode:
|
|
125
|
-
createDecoder:
|
|
146
|
+
decode: decodeLzma2,
|
|
147
|
+
createDecoder: createLzma2Decoder
|
|
126
148
|
});
|
|
127
149
|
// BCJ (x86) filter
|
|
128
150
|
registerCodec(_constantsts.CodecId.BCJ_X86, {
|
|
129
|
-
decode:
|
|
130
|
-
createDecoder:
|
|
151
|
+
decode: _xzcompat.decodeBcj,
|
|
152
|
+
createDecoder: _xzcompat.createBcjDecoder
|
|
131
153
|
});
|
|
132
154
|
// BCJ (ARM) filter
|
|
133
155
|
registerCodec(_constantsts.CodecId.BCJ_ARM, {
|
|
134
|
-
decode:
|
|
135
|
-
createDecoder:
|
|
156
|
+
decode: _xzcompat.decodeBcjArm,
|
|
157
|
+
createDecoder: _xzcompat.createBcjArmDecoder
|
|
136
158
|
});
|
|
137
159
|
// BCJ (ARM Thumb) filter
|
|
138
160
|
registerCodec(_constantsts.CodecId.BCJ_ARMT, {
|
|
139
|
-
decode:
|
|
140
|
-
createDecoder:
|
|
161
|
+
decode: _xzcompat.decodeBcjArmt,
|
|
162
|
+
createDecoder: _xzcompat.createBcjArmtDecoder
|
|
141
163
|
});
|
|
142
164
|
// BCJ (ARM64) filter
|
|
143
165
|
registerCodec(_constantsts.CodecId.BCJ_ARM64, {
|
|
144
|
-
decode:
|
|
145
|
-
createDecoder:
|
|
166
|
+
decode: _xzcompat.decodeBcjArm64,
|
|
167
|
+
createDecoder: _xzcompat.createBcjArm64Decoder
|
|
146
168
|
});
|
|
147
169
|
// BCJ (PowerPC) filter
|
|
148
170
|
registerCodec(_constantsts.CodecId.BCJ_PPC, {
|
|
149
|
-
decode:
|
|
150
|
-
createDecoder:
|
|
171
|
+
decode: _xzcompat.decodeBcjPpc,
|
|
172
|
+
createDecoder: _xzcompat.createBcjPpcDecoder
|
|
151
173
|
});
|
|
152
174
|
// BCJ (IA64) filter
|
|
153
175
|
registerCodec(_constantsts.CodecId.BCJ_IA64, {
|
|
154
|
-
decode:
|
|
155
|
-
createDecoder:
|
|
176
|
+
decode: _xzcompat.decodeBcjIa64,
|
|
177
|
+
createDecoder: _xzcompat.createBcjIa64Decoder
|
|
156
178
|
});
|
|
157
179
|
// BCJ (SPARC) filter
|
|
158
180
|
registerCodec(_constantsts.CodecId.BCJ_SPARC, {
|
|
159
|
-
decode:
|
|
160
|
-
createDecoder:
|
|
181
|
+
decode: _xzcompat.decodeBcjSparc,
|
|
182
|
+
createDecoder: _xzcompat.createBcjSparcDecoder
|
|
161
183
|
});
|
|
162
184
|
// Delta filter
|
|
163
185
|
registerCodec(_constantsts.CodecId.DELTA, {
|
|
164
|
-
decode:
|
|
165
|
-
createDecoder:
|
|
186
|
+
decode: _xzcompat.decodeDelta,
|
|
187
|
+
createDecoder: _xzcompat.createDeltaDecoder
|
|
166
188
|
});
|
|
167
189
|
// Deflate codec
|
|
168
190
|
registerCodec(_constantsts.CodecId.DEFLATE, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/index.ts"],"sourcesContent":["// Codec registry for 7z decompression\n// Each codec provides a decode function and optionally a streaming decoder\n\nimport type { Transform } from 'stream';\nimport { CodecId, createCodedError, ErrorCode } from '../constants.ts';\nimport { createAesDecoder, decodeAes, getPassword, setPassword } from './Aes.ts';\nimport { createBcjDecoder, decodeBcj } from './Bcj.ts';\nimport { createBcj2Decoder, decodeBcj2, decodeBcj2Multi } from './Bcj2.ts';\nimport { createBcjArmDecoder, decodeBcjArm } from './BcjArm.ts';\nimport { createBcjArm64Decoder, decodeBcjArm64 } from './BcjArm64.ts';\nimport { createBcjArmtDecoder, decodeBcjArmt } from './BcjArmt.ts';\nimport { createBcjIa64Decoder, decodeBcjIa64 } from './BcjIa64.ts';\nimport { createBcjPpcDecoder, decodeBcjPpc } from './BcjPpc.ts';\nimport { createBcjSparcDecoder, decodeBcjSparc } from './BcjSparc.ts';\nimport { createBzip2Decoder, decodeBzip2 } from './BZip2.ts';\nimport { createCopyDecoder, decodeCopy } from './Copy.ts';\nimport { createDeflateDecoder, decodeDeflate } from './Deflate.ts';\nimport { createDeltaDecoder, decodeDelta } from './Delta.ts';\nimport { createLzmaDecoder, decodeLzma } from './Lzma.ts';\nimport { createLzma2Decoder, decodeLzma2 } from './Lzma2.ts';\n\n// Re-export password functions for API access\nexport { getPassword, setPassword };\n\nexport interface Codec {\n decode: (input: Buffer, properties?: Buffer, unpackSize?: number) => Buffer;\n createDecoder: (properties?: Buffer, unpackSize?: number) => Transform;\n}\n\n// Registry of supported codecs\nconst codecs: { [key: string]: Codec } = {};\n\n/**\n * Convert codec ID bytes to a string key\n */\nfunction codecIdToKey(id: number[]): string {\n const parts: string[] = [];\n for (let i = 0; i < id.length; i++) {\n parts.push(id[i].toString(16).toUpperCase());\n }\n return parts.join('-');\n}\n\n/**\n * Check if two codec IDs match\n */\nfunction codecIdEquals(a: number[], b: number[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Register a codec\n */\nexport function registerCodec(id: number[], codec: Codec): void {\n codecs[codecIdToKey(id)] = codec;\n}\n\n/**\n * Get a codec by ID\n * @throws Error if codec is not supported\n */\nexport function getCodec(id: number[]): Codec {\n const key = codecIdToKey(id);\n const codec = codecs[key];\n if (!codec) {\n throw createCodedError(`Unsupported codec: ${key}`, ErrorCode.UNSUPPORTED_CODEC);\n }\n return codec;\n}\n\n/**\n * Check if a codec is supported\n */\nexport function isCodecSupported(id: number[]): boolean {\n return codecs[codecIdToKey(id)] !== undefined;\n}\n\n/**\n * Get human-readable codec name\n */\nexport function getCodecName(id: number[]): string {\n if (codecIdEquals(id, CodecId.COPY)) return 'Copy';\n if (codecIdEquals(id, CodecId.LZMA)) return 'LZMA';\n if (codecIdEquals(id, CodecId.LZMA2)) return 'LZMA2';\n if (codecIdEquals(id, CodecId.BCJ_X86)) return 'BCJ (x86)';\n if (codecIdEquals(id, CodecId.BCJ_ARM)) return 'BCJ (ARM)';\n if (codecIdEquals(id, CodecId.BCJ_ARMT)) return 'BCJ (ARM Thumb)';\n if (codecIdEquals(id, CodecId.BCJ_ARM64)) return 'BCJ (ARM64)';\n if (codecIdEquals(id, CodecId.BCJ_PPC)) return 'BCJ (PowerPC)';\n if (codecIdEquals(id, CodecId.BCJ_IA64)) return 'BCJ (IA64)';\n if (codecIdEquals(id, CodecId.BCJ_SPARC)) return 'BCJ (SPARC)';\n if (codecIdEquals(id, CodecId.BCJ2)) return 'BCJ2';\n if (codecIdEquals(id, CodecId.PPMD)) return 'PPMd';\n if (codecIdEquals(id, CodecId.DELTA)) return 'Delta';\n if (codecIdEquals(id, CodecId.DEFLATE)) return 'Deflate';\n if (codecIdEquals(id, CodecId.BZIP2)) return 'BZip2';\n if (codecIdEquals(id, CodecId.AES)) return 'AES-256';\n return `Unknown (${codecIdToKey(id)})`;\n}\n\n/**\n * Check if a codec ID matches BCJ2\n */\nexport function isBcj2Codec(id: number[]): boolean {\n return codecIdEquals(id, CodecId.BCJ2);\n}\n\n// Re-export BCJ2 multi-stream decoder for special handling\nexport { decodeBcj2Multi };\n\n// Register built-in codecs\n\n// Copy codec (no compression)\nregisterCodec(CodecId.COPY, {\n decode: decodeCopy,\n createDecoder: createCopyDecoder,\n});\n\n// LZMA codec\nregisterCodec(CodecId.LZMA, {\n decode: decodeLzma,\n createDecoder: createLzmaDecoder,\n});\n\n// LZMA2 codec\nregisterCodec(CodecId.LZMA2, {\n decode: decodeLzma2,\n createDecoder: createLzma2Decoder,\n});\n\n// BCJ (x86) filter\nregisterCodec(CodecId.BCJ_X86, {\n decode: decodeBcj,\n createDecoder: createBcjDecoder,\n});\n\n// BCJ (ARM) filter\nregisterCodec(CodecId.BCJ_ARM, {\n decode: decodeBcjArm,\n createDecoder: createBcjArmDecoder,\n});\n\n// BCJ (ARM Thumb) filter\nregisterCodec(CodecId.BCJ_ARMT, {\n decode: decodeBcjArmt,\n createDecoder: createBcjArmtDecoder,\n});\n\n// BCJ (ARM64) filter\nregisterCodec(CodecId.BCJ_ARM64, {\n decode: decodeBcjArm64,\n createDecoder: createBcjArm64Decoder,\n});\n\n// BCJ (PowerPC) filter\nregisterCodec(CodecId.BCJ_PPC, {\n decode: decodeBcjPpc,\n createDecoder: createBcjPpcDecoder,\n});\n\n// BCJ (IA64) filter\nregisterCodec(CodecId.BCJ_IA64, {\n decode: decodeBcjIa64,\n createDecoder: createBcjIa64Decoder,\n});\n\n// BCJ (SPARC) filter\nregisterCodec(CodecId.BCJ_SPARC, {\n decode: decodeBcjSparc,\n createDecoder: createBcjSparcDecoder,\n});\n\n// Delta filter\nregisterCodec(CodecId.DELTA, {\n decode: decodeDelta,\n createDecoder: createDeltaDecoder,\n});\n\n// Deflate codec\nregisterCodec(CodecId.DEFLATE, {\n decode: decodeDeflate,\n createDecoder: createDeflateDecoder,\n});\n\n// BZip2 codec\nregisterCodec(CodecId.BZIP2, {\n decode: decodeBzip2,\n createDecoder: createBzip2Decoder,\n});\n\n// AES-256-CBC codec (encryption)\nregisterCodec(CodecId.AES, {\n decode: decodeAes,\n createDecoder: createAesDecoder,\n});\n\n// BCJ2 (x86-64) filter - multi-stream\n// Note: BCJ2 requires special handling in SevenZipParser due to 4-stream architecture\nregisterCodec(CodecId.BCJ2, {\n decode: decodeBcj2,\n createDecoder: createBcj2Decoder,\n});\n\n// Note: PPMd codec is not implemented. See FUTURE_ENHANCEMENTS.md\n"],"names":["decodeBcj2Multi","getCodec","getCodecName","getPassword","isBcj2Codec","isCodecSupported","registerCodec","setPassword","codecs","codecIdToKey","id","parts","i","length","push","toString","toUpperCase","join","codecIdEquals","a","b","codec","key","createCodedError","ErrorCode","UNSUPPORTED_CODEC","undefined","CodecId","COPY","LZMA","LZMA2","BCJ_X86","BCJ_ARM","BCJ_ARMT","BCJ_ARM64","BCJ_PPC","BCJ_IA64","BCJ_SPARC","BCJ2","PPMD","DELTA","DEFLATE","BZIP2","AES","decode","decodeCopy","createDecoder","createCopyDecoder","decodeLzma","createLzmaDecoder","decodeLzma2","createLzma2Decoder","decodeBcj","createBcjDecoder","decodeBcjArm","createBcjArmDecoder","decodeBcjArmt","createBcjArmtDecoder","decodeBcjArm64","createBcjArm64Decoder","decodeBcjPpc","createBcjPpcDecoder","decodeBcjIa64","createBcjIa64Decoder","decodeBcjSparc","createBcjSparcDecoder","decodeDelta","createDeltaDecoder","decodeDeflate","createDeflateDecoder","decodeBzip2","createBzip2Decoder","decodeAes","createAesDecoder","decodeBcj2","createBcj2Decoder"],"mappings":"AAAA,sCAAsC;AACtC,2EAA2E;;;;;;;;;;;;QA+GlEA;eAAAA,uBAAe;;QA/CRC;eAAAA;;QAmBAC;eAAAA;;QA9DPC;eAAAA,kBAAW;;QAqFJC;eAAAA;;QA9BAC;eAAAA;;QApBAC;eAAAA;;QAnCMC;eAAAA,kBAAW;;;2BAlBoB;qBACiB;qBAC1B;sBACmB;wBACb;0BACI;yBACF;yBACA;wBACF;0BACI;uBACN;sBACF;yBACM;uBACJ;sBACF;uBACE;AAUhD,+BAA+B;AAC/B,IAAMC,SAAmC,CAAC;AAE1C;;CAEC,GACD,SAASC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,eAAe6B,yBAAiB;AAClC,IAEA,kEAAkE"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/index.ts"],"sourcesContent":["// Codec registry for 7z decompression\n// Each codec provides a decode function and optionally a streaming decoder\n\nimport type { Transform } from 'stream';\nimport {\n createLzma2Decoder as _createLzma2Decoder,\n createLzmaDecoder as _createLzmaDecoder,\n createBcjArm64Decoder,\n createBcjArmDecoder,\n createBcjArmtDecoder,\n createBcjDecoder,\n createBcjIa64Decoder,\n createBcjPpcDecoder,\n createBcjSparcDecoder,\n createDeltaDecoder,\n decode7zLzma,\n decode7zLzma2,\n decodeBcj,\n decodeBcjArm,\n decodeBcjArm64,\n decodeBcjArmt,\n decodeBcjIa64,\n decodeBcjPpc,\n decodeBcjSparc,\n decodeDelta,\n} from 'xz-compat';\nimport { CodecId, createCodedError, ErrorCode } from '../constants.ts';\nimport { createAesDecoder, decodeAes, getPassword, setPassword } from './Aes.ts';\nimport { createBcj2Decoder, decodeBcj2, decodeBcj2Multi } from './Bcj2.ts';\nimport { createBzip2Decoder, decodeBzip2 } from './BZip2.ts';\nimport { createCopyDecoder, decodeCopy } from './Copy.ts';\nimport { createDeflateDecoder, decodeDeflate } from './Deflate.ts';\n\n// Re-export password functions for API access\nexport { getPassword, setPassword };\n\nexport interface Codec {\n decode: (input: Buffer, properties?: Buffer, unpackSize?: number) => Buffer;\n createDecoder: (properties?: Buffer, unpackSize?: number) => Transform;\n}\n\n// Simple wrappers with validation that use xz-compat's optimized decode7zLjma/decode7zLzma2\nfunction decodeLzma(input: Buffer, properties?: Buffer, unpackSize?: number): Buffer {\n if (!properties || properties.length < 5) {\n throw new Error('LZMA requires 5-byte properties');\n }\n if (typeof unpackSize !== 'number' || unpackSize < 0) {\n throw new Error('LZMA requires known unpack size');\n }\n return decode7zLzma(input, properties, unpackSize);\n}\n\nfunction createLzmaDecoder(properties?: Buffer, unpackSize?: number): Transform {\n if (!properties || properties.length < 5) {\n throw new Error('LZMA requires 5-byte properties');\n }\n if (typeof unpackSize !== 'number' || unpackSize < 0) {\n throw new Error('LZMA requires known unpack size');\n }\n return _createLzmaDecoder(properties, unpackSize) as Transform;\n}\n\nfunction decodeLzma2(input: Buffer, properties?: Buffer, unpackSize?: number): Buffer {\n if (!properties || properties.length < 1) {\n throw new Error('LZMA2 requires properties byte');\n }\n return decode7zLzma2(input, properties, unpackSize);\n}\n\nfunction createLzma2Decoder(properties?: Buffer, _unpackSize?: number): Transform {\n if (!properties || properties.length < 1) {\n throw new Error('LZMA2 requires properties byte');\n }\n return _createLzma2Decoder(properties) as Transform;\n}\n\n// Registry of supported codecs\nconst codecs: { [key: string]: Codec } = {};\n\n/**\n * Convert codec ID bytes to a string key\n */\nfunction codecIdToKey(id: number[]): string {\n const parts: string[] = [];\n for (let i = 0; i < id.length; i++) {\n parts.push(id[i].toString(16).toUpperCase());\n }\n return parts.join('-');\n}\n\n/**\n * Check if two codec IDs match\n */\nfunction codecIdEquals(a: number[], b: number[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Register a codec\n */\nexport function registerCodec(id: number[], codec: Codec): void {\n codecs[codecIdToKey(id)] = codec;\n}\n\n/**\n * Get a codec by ID\n * @throws Error if codec is not supported\n */\nexport function getCodec(id: number[]): Codec {\n const key = codecIdToKey(id);\n const codec = codecs[key];\n if (!codec) {\n throw createCodedError(`Unsupported codec: ${key}`, ErrorCode.UNSUPPORTED_CODEC);\n }\n return codec;\n}\n\n/**\n * Check if a codec is supported\n */\nexport function isCodecSupported(id: number[]): boolean {\n return codecs[codecIdToKey(id)] !== undefined;\n}\n\n/**\n * Get human-readable codec name\n */\nexport function getCodecName(id: number[]): string {\n if (codecIdEquals(id, CodecId.COPY)) return 'Copy';\n if (codecIdEquals(id, CodecId.LZMA)) return 'LZMA';\n if (codecIdEquals(id, CodecId.LZMA2)) return 'LZMA2';\n if (codecIdEquals(id, CodecId.BCJ_X86)) return 'BCJ (x86)';\n if (codecIdEquals(id, CodecId.BCJ_ARM)) return 'BCJ (ARM)';\n if (codecIdEquals(id, CodecId.BCJ_ARMT)) return 'BCJ (ARM Thumb)';\n if (codecIdEquals(id, CodecId.BCJ_ARM64)) return 'BCJ (ARM64)';\n if (codecIdEquals(id, CodecId.BCJ_PPC)) return 'BCJ (PowerPC)';\n if (codecIdEquals(id, CodecId.BCJ_IA64)) return 'BCJ (IA64)';\n if (codecIdEquals(id, CodecId.BCJ_SPARC)) return 'BCJ (SPARC)';\n if (codecIdEquals(id, CodecId.BCJ2)) return 'BCJ2';\n if (codecIdEquals(id, CodecId.PPMD)) return 'PPMd';\n if (codecIdEquals(id, CodecId.DELTA)) return 'Delta';\n if (codecIdEquals(id, CodecId.DEFLATE)) return 'Deflate';\n if (codecIdEquals(id, CodecId.BZIP2)) return 'BZip2';\n if (codecIdEquals(id, CodecId.AES)) return 'AES-256';\n return `Unknown (${codecIdToKey(id)})`;\n}\n\n/**\n * Check if a codec ID matches BCJ2\n */\nexport function isBcj2Codec(id: number[]): boolean {\n return codecIdEquals(id, CodecId.BCJ2);\n}\n\n// Re-export BCJ2 multi-stream decoder for special handling\nexport { decodeBcj2Multi };\n\n// Register built-in codecs\n\n// Copy codec (no compression)\nregisterCodec(CodecId.COPY, {\n decode: decodeCopy,\n createDecoder: createCopyDecoder,\n});\n\n// LZMA codec\nregisterCodec(CodecId.LZMA, {\n decode: decodeLzma,\n createDecoder: createLzmaDecoder,\n});\n\n// LZMA2 codec\nregisterCodec(CodecId.LZMA2, {\n decode: decodeLzma2,\n createDecoder: createLzma2Decoder,\n});\n\n// BCJ (x86) filter\nregisterCodec(CodecId.BCJ_X86, {\n decode: decodeBcj,\n createDecoder: createBcjDecoder,\n});\n\n// BCJ (ARM) filter\nregisterCodec(CodecId.BCJ_ARM, {\n decode: decodeBcjArm,\n createDecoder: createBcjArmDecoder,\n});\n\n// BCJ (ARM Thumb) filter\nregisterCodec(CodecId.BCJ_ARMT, {\n decode: decodeBcjArmt,\n createDecoder: createBcjArmtDecoder,\n});\n\n// BCJ (ARM64) filter\nregisterCodec(CodecId.BCJ_ARM64, {\n decode: decodeBcjArm64,\n createDecoder: createBcjArm64Decoder,\n});\n\n// BCJ (PowerPC) filter\nregisterCodec(CodecId.BCJ_PPC, {\n decode: decodeBcjPpc,\n createDecoder: createBcjPpcDecoder,\n});\n\n// BCJ (IA64) filter\nregisterCodec(CodecId.BCJ_IA64, {\n decode: decodeBcjIa64,\n createDecoder: createBcjIa64Decoder,\n});\n\n// BCJ (SPARC) filter\nregisterCodec(CodecId.BCJ_SPARC, {\n decode: decodeBcjSparc,\n createDecoder: createBcjSparcDecoder,\n});\n\n// Delta filter\nregisterCodec(CodecId.DELTA, {\n decode: decodeDelta,\n createDecoder: createDeltaDecoder,\n});\n\n// Deflate codec\nregisterCodec(CodecId.DEFLATE, {\n decode: decodeDeflate,\n createDecoder: createDeflateDecoder,\n});\n\n// BZip2 codec\nregisterCodec(CodecId.BZIP2, {\n decode: decodeBzip2,\n createDecoder: createBzip2Decoder,\n});\n\n// AES-256-CBC codec (encryption)\nregisterCodec(CodecId.AES, {\n decode: decodeAes,\n createDecoder: createAesDecoder,\n});\n\n// BCJ2 (x86-64) filter - multi-stream\n// Note: BCJ2 requires special handling in SevenZipParser due to 4-stream architecture\nregisterCodec(CodecId.BCJ2, {\n decode: decodeBcj2,\n createDecoder: createBcj2Decoder,\n});\n\n// Note: PPMd codec is not implemented. See FUTURE_ENHANCEMENTS.md\n"],"names":["decodeBcj2Multi","getCodec","getCodecName","getPassword","isBcj2Codec","isCodecSupported","registerCodec","setPassword","decodeLzma","input","properties","unpackSize","length","Error","decode7zLzma","createLzmaDecoder","_createLzmaDecoder","decodeLzma2","decode7zLzma2","createLzma2Decoder","_unpackSize","_createLzma2Decoder","codecs","codecIdToKey","id","parts","i","push","toString","toUpperCase","join","codecIdEquals","a","b","codec","key","createCodedError","ErrorCode","UNSUPPORTED_CODEC","undefined","CodecId","COPY","LZMA","LZMA2","BCJ_X86","BCJ_ARM","BCJ_ARMT","BCJ_ARM64","BCJ_PPC","BCJ_IA64","BCJ_SPARC","BCJ2","PPMD","DELTA","DEFLATE","BZIP2","AES","decode","decodeCopy","createDecoder","createCopyDecoder","decodeBcj","createBcjDecoder","decodeBcjArm","createBcjArmDecoder","decodeBcjArmt","createBcjArmtDecoder","decodeBcjArm64","createBcjArm64Decoder","decodeBcjPpc","createBcjPpcDecoder","decodeBcjIa64","createBcjIa64Decoder","decodeBcjSparc","createBcjSparcDecoder","decodeDelta","createDeltaDecoder","decodeDeflate","createDeflateDecoder","decodeBzip2","createBzip2Decoder","decodeAes","createAesDecoder","decodeBcj2","createBcj2Decoder"],"mappings":"AAAA,sCAAsC;AACtC,2EAA2E;;;;;;;;;;;;QA8JlEA;eAAAA,uBAAe;;QA/CRC;eAAAA;;QAmBAC;eAAAA;;QAjGPC;eAAAA,kBAAW;;QAwHJC;eAAAA;;QA9BAC;eAAAA;;QApBAC;eAAAA;;QAtEMC;eAAAA,kBAAW;;;wBAT1B;2BAC8C;qBACiB;sBACP;uBACf;sBACF;yBACM;AAUpD,4FAA4F;AAC5F,SAASC,WAAWC,KAAa,EAAEC,UAAmB,EAAEC,UAAmB;IACzE,IAAI,CAACD,cAAcA,WAAWE,MAAM,GAAG,GAAG;QACxC,MAAM,IAAIC,MAAM;IAClB;IACA,IAAI,OAAOF,eAAe,YAAYA,aAAa,GAAG;QACpD,MAAM,IAAIE,MAAM;IAClB;IACA,OAAOC,IAAAA,sBAAY,EAACL,OAAOC,YAAYC;AACzC;AAEA,SAASI,kBAAkBL,UAAmB,EAAEC,UAAmB;IACjE,IAAI,CAACD,cAAcA,WAAWE,MAAM,GAAG,GAAG;QACxC,MAAM,IAAIC,MAAM;IAClB;IACA,IAAI,OAAOF,eAAe,YAAYA,aAAa,GAAG;QACpD,MAAM,IAAIE,MAAM;IAClB;IACA,OAAOG,IAAAA,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,cAAckC,oBAAO,CAACc,OAAO,EAAE;IAC7BG,QAAQoB,wBAAa;IACrBlB,eAAemB,+BAAoB;AACrC;AAEA,cAAc;AACdxE,cAAckC,oBAAO,CAACe,KAAK,EAAE;IAC3BE,QAAQsB,oBAAW;IACnBpB,eAAeqB,2BAAkB;AACnC;AAEA,iCAAiC;AACjC1E,cAAckC,oBAAO,CAACgB,GAAG,EAAE;IACzBC,QAAQwB,gBAAS;IACjBtB,eAAeuB,uBAAgB;AACjC;AAEA,sCAAsC;AACtC,sFAAsF;AACtF5E,cAAckC,oBAAO,CAACW,IAAI,EAAE;IAC1BM,QAAQ0B,kBAAU;IAClBxB,eAAeyB,yBAAiB;AAClC,IAEA,kEAAkE"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './FileEntry.js';
|
|
2
|
+
export * from './nextEntry.js';
|
|
3
3
|
export { default } from './SevenZipIterator.js';
|
|
4
|
+
export * from './sevenz/index.js';
|
|
4
5
|
export * from './types.js';
|
|
5
|
-
export { createXZDecoder, decodeXZ } from './xz/Decoder.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
//
|
|
2
|
-
export
|
|
1
|
+
// 7z-iterator - high-level 7z archive iterator
|
|
2
|
+
export * from './FileEntry.js';
|
|
3
|
+
export * from './nextEntry.js';
|
|
3
4
|
export { default } from './SevenZipIterator.js';
|
|
5
|
+
export * from './sevenz/index.js';
|
|
4
6
|
export * from './types.js';
|
|
5
|
-
export { createXZDecoder, decodeXZ } from './xz/Decoder.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/index.ts"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/index.ts"],"sourcesContent":["// 7z-iterator - high-level 7z archive iterator\n\nexport * from './FileEntry.ts';\nexport * from './nextEntry.ts';\nexport { default } from './SevenZipIterator.ts';\nexport * from './sevenz/index.ts';\nexport * from './types.ts';\n"],"names":["default"],"mappings":"AAAA,+CAA+C;AAE/C,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,SAASA,OAAO,QAAQ,wBAAwB;AAChD,cAAc,oBAAoB;AAClC,cAAc,aAAa"}
|
package/dist/esm/nextEntry.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import once from 'call-once-fn';
|
|
2
2
|
import { DirectoryEntry, SymbolicLinkEntry } from 'extract-base-iterator';
|
|
3
|
-
import compact from 'lodash.compact';
|
|
4
3
|
import path from 'path';
|
|
5
4
|
import FileEntry from './FileEntry.js';
|
|
6
5
|
export default function nextEntry(iterator, callback) {
|
|
@@ -41,7 +40,7 @@ export default function nextEntry(iterator, callback) {
|
|
|
41
40
|
// mtime must be timestamp (number) for FileAttributes compatibility
|
|
42
41
|
const mtimeDate = entry.mtime || new Date();
|
|
43
42
|
const attributes = {
|
|
44
|
-
path:
|
|
43
|
+
path: entry.path.split(path.sep).filter(Boolean).join(path.sep),
|
|
45
44
|
basename: entry.name,
|
|
46
45
|
mtime: mtimeDate.getTime(),
|
|
47
46
|
mode: entry.mode !== undefined ? entry.mode : defaultMode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type DirectoryAttributes, DirectoryEntry, type FileAttributes, type LinkAttributes, SymbolicLinkEntry } from 'extract-base-iterator';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type DirectoryAttributes, DirectoryEntry, type FileAttributes, type LinkAttributes, SymbolicLinkEntry } from 'extract-base-iterator';\nimport path from 'path';\nimport FileEntry from './FileEntry.ts';\nimport type SevenZipIterator from './SevenZipIterator.ts';\nimport type { SevenZipEntry, SevenZipParser } from './sevenz/SevenZipParser.ts';\nimport type { Entry, EntryCallback } from './types.ts';\n\nexport type NextCallback = (error?: Error, entry?: Entry) => void;\n\n/** @internal */\ninterface InternalIterator {\n next(): SevenZipEntry | null;\n getParser(): SevenZipParser;\n}\n\n// Entry attributes object that gets mutated in switch - union of possible shapes\n// mtime is number for FileAttributes compatibility (timestamp in ms)\ntype EntryAttributesBuilder = {\n path: string;\n basename: string;\n mtime: number;\n mode: number;\n type?: 'file' | 'directory';\n size?: number;\n};\n\nexport default function nextEntry<_T>(iterator: SevenZipIterator, callback: EntryCallback): void {\n const internalIter = iterator._iterator as InternalIterator | null;\n if (!internalIter) {\n callback(new Error('iterator missing'));\n return;\n }\n\n let entry: SevenZipEntry | null = null;\n entry = internalIter.next();\n\n const nextCallback = once((err?: Error, entry?: Entry) => {\n // keep processing\n if (entry) iterator.push(nextEntry);\n err ? callback(err) : callback(null, entry ? { done: false, value: entry } : { done: true, value: null });\n }) as NextCallback;\n\n // done: signal iteration is complete (guard against stale lock)\n if (!iterator.lock || iterator.isDone() || !entry) return callback(null, { done: true, value: null });\n\n // Skip anti-files (these mark files to delete in delta archives)\n if (entry.isAntiFile) {\n iterator.push(nextEntry);\n return callback(null, null);\n }\n\n // Determine type from entry\n const type = entry.type;\n\n // Default modes (decimal values for Node 0.8 compatibility)\n // 0o755 = 493, 0o644 = 420\n const defaultMode = type === 'directory' ? 493 : 420;\n\n // Build attributes from 7z entry\n // mtime must be timestamp (number) for FileAttributes compatibility\n const mtimeDate = entry.mtime || new Date();\n const attributes: EntryAttributesBuilder = {\n path: entry.path.split(path.sep).filter(Boolean).join(path.sep),\n basename: entry.name,\n mtime: mtimeDate.getTime(),\n mode: entry.mode !== undefined ? entry.mode : defaultMode,\n };\n\n switch (type) {\n case 'directory':\n attributes.type = 'directory';\n return nextCallback(null, new DirectoryEntry(attributes as DirectoryAttributes));\n\n case 'link': {\n // For symlinks, the file content IS the symlink target path\n // Read the content to get the linkpath for SymbolicLinkEntry\n const parser = internalIter.getParser();\n const stream = parser.getEntryStream(entry);\n\n const chunks: Buffer[] = [];\n\n stream.on('data', (chunk: Buffer) => {\n chunks.push(chunk);\n });\n stream.on('end', () => {\n const linkpath = Buffer.concat(chunks).toString('utf8');\n\n const linkAttributes: LinkAttributes = {\n path: attributes.path,\n mtime: attributes.mtime,\n mode: attributes.mode,\n linkpath: linkpath,\n };\n\n nextCallback(null, new SymbolicLinkEntry(linkAttributes));\n });\n stream.on('error', (streamErr: Error) => {\n nextCallback(streamErr);\n });\n return;\n }\n\n case 'file': {\n attributes.type = 'file';\n attributes.size = entry.size;\n const parser = internalIter.getParser();\n\n const stream = parser.getEntryStream(entry);\n return nextCallback(null, new FileEntry(attributes as FileAttributes, stream, iterator.lock, entry._canStream));\n }\n }\n\n return callback(new Error(`Unrecognized entry type: ${type}`));\n}\n"],"names":["once","DirectoryEntry","SymbolicLinkEntry","path","FileEntry","nextEntry","iterator","callback","internalIter","_iterator","Error","entry","next","nextCallback","err","push","done","value","lock","isDone","isAntiFile","type","defaultMode","mtimeDate","mtime","Date","attributes","split","sep","filter","Boolean","join","basename","name","getTime","mode","undefined","parser","getParser","stream","getEntryStream","chunks","on","chunk","linkpath","Buffer","concat","toString","linkAttributes","streamErr","size","_canStream"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,SAAmCC,cAAc,EAA4CC,iBAAiB,QAAQ,wBAAwB;AAC9I,OAAOC,UAAU,OAAO;AACxB,OAAOC,eAAe,iBAAiB;AAwBvC,eAAe,SAASC,UAAcC,QAA0B,EAAEC,QAAuB;IACvF,MAAMC,eAAeF,SAASG,SAAS;IACvC,IAAI,CAACD,cAAc;QACjBD,SAAS,IAAIG,MAAM;QACnB;IACF;IAEA,IAAIC,QAA8B;IAClCA,QAAQH,aAAaI,IAAI;IAEzB,MAAMC,eAAeb,KAAK,CAAC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J,OAAOG,EAAE,CAAC,OAAO;oBACf,MAAME,WAAWC,OAAOC,MAAM,CAACL,QAAQM,QAAQ,CAAC;oBAEhD,MAAMC,iBAAiC;wBACrC7C,MAAMuB,WAAWvB,IAAI;wBACrBqB,OAAOE,WAAWF,KAAK;wBACvBW,MAAMT,WAAWS,IAAI;wBACrBS,UAAUA;oBACZ;oBAEA/B,aAAa,MAAM,IAAIX,kBAAkB8C;gBAC3C;gBACAT,OAAOG,EAAE,CAAC,SAAS,CAACO;oBAClBpC,aAAaoC;gBACf;gBACA;YACF;QAEA,KAAK;YAAQ;gBACXvB,WAAWL,IAAI,GAAG;gBAClBK,WAAWwB,IAAI,GAAGvC,MAAMuC,IAAI;gBAC5B,MAAMb,SAAS7B,aAAa8B,SAAS;gBAErC,MAAMC,SAASF,OAAOG,cAAc,CAAC7B;gBACrC,OAAOE,aAAa,MAAM,IAAIT,UAAUsB,YAA8Ba,QAAQjC,SAASY,IAAI,EAAEP,MAAMwC,UAAU;YAC/G;IACF;IAEA,OAAO5C,SAAS,IAAIG,MAAM,CAAC,yBAAyB,EAAEW,MAAM;AAC9D"}
|
|
@@ -1,23 +1,45 @@
|
|
|
1
1
|
// Codec registry for 7z decompression
|
|
2
2
|
// Each codec provides a decode function and optionally a streaming decoder
|
|
3
|
+
import { createLzma2Decoder as _createLzma2Decoder, createLzmaDecoder as _createLzmaDecoder, createBcjArm64Decoder, createBcjArmDecoder, createBcjArmtDecoder, createBcjDecoder, createBcjIa64Decoder, createBcjPpcDecoder, createBcjSparcDecoder, createDeltaDecoder, decode7zLzma, decode7zLzma2, decodeBcj, decodeBcjArm, decodeBcjArm64, decodeBcjArmt, decodeBcjIa64, decodeBcjPpc, decodeBcjSparc, decodeDelta } from 'xz-compat';
|
|
3
4
|
import { CodecId, createCodedError, ErrorCode } from '../constants.js';
|
|
4
5
|
import { createAesDecoder, decodeAes, getPassword, setPassword } from './Aes.js';
|
|
5
|
-
import { createBcjDecoder, decodeBcj } from './Bcj.js';
|
|
6
6
|
import { createBcj2Decoder, decodeBcj2, decodeBcj2Multi } from './Bcj2.js';
|
|
7
|
-
import { createBcjArmDecoder, decodeBcjArm } from './BcjArm.js';
|
|
8
|
-
import { createBcjArm64Decoder, decodeBcjArm64 } from './BcjArm64.js';
|
|
9
|
-
import { createBcjArmtDecoder, decodeBcjArmt } from './BcjArmt.js';
|
|
10
|
-
import { createBcjIa64Decoder, decodeBcjIa64 } from './BcjIa64.js';
|
|
11
|
-
import { createBcjPpcDecoder, decodeBcjPpc } from './BcjPpc.js';
|
|
12
|
-
import { createBcjSparcDecoder, decodeBcjSparc } from './BcjSparc.js';
|
|
13
7
|
import { createBzip2Decoder, decodeBzip2 } from './BZip2.js';
|
|
14
8
|
import { createCopyDecoder, decodeCopy } from './Copy.js';
|
|
15
9
|
import { createDeflateDecoder, decodeDeflate } from './Deflate.js';
|
|
16
|
-
import { createDeltaDecoder, decodeDelta } from './Delta.js';
|
|
17
|
-
import { createLzmaDecoder, decodeLzma } from './Lzma.js';
|
|
18
|
-
import { createLzma2Decoder, decodeLzma2 } from './Lzma2.js';
|
|
19
10
|
// Re-export password functions for API access
|
|
20
11
|
export { getPassword, setPassword };
|
|
12
|
+
// Simple wrappers with validation that use xz-compat's optimized decode7zLjma/decode7zLzma2
|
|
13
|
+
function decodeLzma(input, properties, unpackSize) {
|
|
14
|
+
if (!properties || properties.length < 5) {
|
|
15
|
+
throw new Error('LZMA requires 5-byte properties');
|
|
16
|
+
}
|
|
17
|
+
if (typeof unpackSize !== 'number' || unpackSize < 0) {
|
|
18
|
+
throw new Error('LZMA requires known unpack size');
|
|
19
|
+
}
|
|
20
|
+
return decode7zLzma(input, properties, unpackSize);
|
|
21
|
+
}
|
|
22
|
+
function createLzmaDecoder(properties, unpackSize) {
|
|
23
|
+
if (!properties || properties.length < 5) {
|
|
24
|
+
throw new Error('LZMA requires 5-byte properties');
|
|
25
|
+
}
|
|
26
|
+
if (typeof unpackSize !== 'number' || unpackSize < 0) {
|
|
27
|
+
throw new Error('LZMA requires known unpack size');
|
|
28
|
+
}
|
|
29
|
+
return _createLzmaDecoder(properties, unpackSize);
|
|
30
|
+
}
|
|
31
|
+
function decodeLzma2(input, properties, unpackSize) {
|
|
32
|
+
if (!properties || properties.length < 1) {
|
|
33
|
+
throw new Error('LZMA2 requires properties byte');
|
|
34
|
+
}
|
|
35
|
+
return decode7zLzma2(input, properties, unpackSize);
|
|
36
|
+
}
|
|
37
|
+
function createLzma2Decoder(properties, _unpackSize) {
|
|
38
|
+
if (!properties || properties.length < 1) {
|
|
39
|
+
throw new Error('LZMA2 requires properties byte');
|
|
40
|
+
}
|
|
41
|
+
return _createLzma2Decoder(properties);
|
|
42
|
+
}
|
|
21
43
|
// Registry of supported codecs
|
|
22
44
|
const codecs = {};
|
|
23
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/index.ts"],"sourcesContent":["// Codec registry for 7z decompression\n// Each codec provides a decode function and optionally a streaming decoder\n\nimport type { Transform } from 'stream';\nimport { CodecId, createCodedError, ErrorCode } from '../constants.ts';\nimport { createAesDecoder, decodeAes, getPassword, setPassword } from './Aes.ts';\nimport { createBcjDecoder, decodeBcj } from './Bcj.ts';\nimport { createBcj2Decoder, decodeBcj2, decodeBcj2Multi } from './Bcj2.ts';\nimport { createBcjArmDecoder, decodeBcjArm } from './BcjArm.ts';\nimport { createBcjArm64Decoder, decodeBcjArm64 } from './BcjArm64.ts';\nimport { createBcjArmtDecoder, decodeBcjArmt } from './BcjArmt.ts';\nimport { createBcjIa64Decoder, decodeBcjIa64 } from './BcjIa64.ts';\nimport { createBcjPpcDecoder, decodeBcjPpc } from './BcjPpc.ts';\nimport { createBcjSparcDecoder, decodeBcjSparc } from './BcjSparc.ts';\nimport { createBzip2Decoder, decodeBzip2 } from './BZip2.ts';\nimport { createCopyDecoder, decodeCopy } from './Copy.ts';\nimport { createDeflateDecoder, decodeDeflate } from './Deflate.ts';\nimport { createDeltaDecoder, decodeDelta } from './Delta.ts';\nimport { createLzmaDecoder, decodeLzma } from './Lzma.ts';\nimport { createLzma2Decoder, decodeLzma2 } from './Lzma2.ts';\n\n// Re-export password functions for API access\nexport { getPassword, setPassword };\n\nexport interface Codec {\n decode: (input: Buffer, properties?: Buffer, unpackSize?: number) => Buffer;\n createDecoder: (properties?: Buffer, unpackSize?: number) => Transform;\n}\n\n// Registry of supported codecs\nconst codecs: { [key: string]: Codec } = {};\n\n/**\n * Convert codec ID bytes to a string key\n */\nfunction codecIdToKey(id: number[]): string {\n const parts: string[] = [];\n for (let i = 0; i < id.length; i++) {\n parts.push(id[i].toString(16).toUpperCase());\n }\n return parts.join('-');\n}\n\n/**\n * Check if two codec IDs match\n */\nfunction codecIdEquals(a: number[], b: number[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Register a codec\n */\nexport function registerCodec(id: number[], codec: Codec): void {\n codecs[codecIdToKey(id)] = codec;\n}\n\n/**\n * Get a codec by ID\n * @throws Error if codec is not supported\n */\nexport function getCodec(id: number[]): Codec {\n const key = codecIdToKey(id);\n const codec = codecs[key];\n if (!codec) {\n throw createCodedError(`Unsupported codec: ${key}`, ErrorCode.UNSUPPORTED_CODEC);\n }\n return codec;\n}\n\n/**\n * Check if a codec is supported\n */\nexport function isCodecSupported(id: number[]): boolean {\n return codecs[codecIdToKey(id)] !== undefined;\n}\n\n/**\n * Get human-readable codec name\n */\nexport function getCodecName(id: number[]): string {\n if (codecIdEquals(id, CodecId.COPY)) return 'Copy';\n if (codecIdEquals(id, CodecId.LZMA)) return 'LZMA';\n if (codecIdEquals(id, CodecId.LZMA2)) return 'LZMA2';\n if (codecIdEquals(id, CodecId.BCJ_X86)) return 'BCJ (x86)';\n if (codecIdEquals(id, CodecId.BCJ_ARM)) return 'BCJ (ARM)';\n if (codecIdEquals(id, CodecId.BCJ_ARMT)) return 'BCJ (ARM Thumb)';\n if (codecIdEquals(id, CodecId.BCJ_ARM64)) return 'BCJ (ARM64)';\n if (codecIdEquals(id, CodecId.BCJ_PPC)) return 'BCJ (PowerPC)';\n if (codecIdEquals(id, CodecId.BCJ_IA64)) return 'BCJ (IA64)';\n if (codecIdEquals(id, CodecId.BCJ_SPARC)) return 'BCJ (SPARC)';\n if (codecIdEquals(id, CodecId.BCJ2)) return 'BCJ2';\n if (codecIdEquals(id, CodecId.PPMD)) return 'PPMd';\n if (codecIdEquals(id, CodecId.DELTA)) return 'Delta';\n if (codecIdEquals(id, CodecId.DEFLATE)) return 'Deflate';\n if (codecIdEquals(id, CodecId.BZIP2)) return 'BZip2';\n if (codecIdEquals(id, CodecId.AES)) return 'AES-256';\n return `Unknown (${codecIdToKey(id)})`;\n}\n\n/**\n * Check if a codec ID matches BCJ2\n */\nexport function isBcj2Codec(id: number[]): boolean {\n return codecIdEquals(id, CodecId.BCJ2);\n}\n\n// Re-export BCJ2 multi-stream decoder for special handling\nexport { decodeBcj2Multi };\n\n// Register built-in codecs\n\n// Copy codec (no compression)\nregisterCodec(CodecId.COPY, {\n decode: decodeCopy,\n createDecoder: createCopyDecoder,\n});\n\n// LZMA codec\nregisterCodec(CodecId.LZMA, {\n decode: decodeLzma,\n createDecoder: createLzmaDecoder,\n});\n\n// LZMA2 codec\nregisterCodec(CodecId.LZMA2, {\n decode: decodeLzma2,\n createDecoder: createLzma2Decoder,\n});\n\n// BCJ (x86) filter\nregisterCodec(CodecId.BCJ_X86, {\n decode: decodeBcj,\n createDecoder: createBcjDecoder,\n});\n\n// BCJ (ARM) filter\nregisterCodec(CodecId.BCJ_ARM, {\n decode: decodeBcjArm,\n createDecoder: createBcjArmDecoder,\n});\n\n// BCJ (ARM Thumb) filter\nregisterCodec(CodecId.BCJ_ARMT, {\n decode: decodeBcjArmt,\n createDecoder: createBcjArmtDecoder,\n});\n\n// BCJ (ARM64) filter\nregisterCodec(CodecId.BCJ_ARM64, {\n decode: decodeBcjArm64,\n createDecoder: createBcjArm64Decoder,\n});\n\n// BCJ (PowerPC) filter\nregisterCodec(CodecId.BCJ_PPC, {\n decode: decodeBcjPpc,\n createDecoder: createBcjPpcDecoder,\n});\n\n// BCJ (IA64) filter\nregisterCodec(CodecId.BCJ_IA64, {\n decode: decodeBcjIa64,\n createDecoder: createBcjIa64Decoder,\n});\n\n// BCJ (SPARC) filter\nregisterCodec(CodecId.BCJ_SPARC, {\n decode: decodeBcjSparc,\n createDecoder: createBcjSparcDecoder,\n});\n\n// Delta filter\nregisterCodec(CodecId.DELTA, {\n decode: decodeDelta,\n createDecoder: createDeltaDecoder,\n});\n\n// Deflate codec\nregisterCodec(CodecId.DEFLATE, {\n decode: decodeDeflate,\n createDecoder: createDeflateDecoder,\n});\n\n// BZip2 codec\nregisterCodec(CodecId.BZIP2, {\n decode: decodeBzip2,\n createDecoder: createBzip2Decoder,\n});\n\n// AES-256-CBC codec (encryption)\nregisterCodec(CodecId.AES, {\n decode: decodeAes,\n createDecoder: createAesDecoder,\n});\n\n// BCJ2 (x86-64) filter - multi-stream\n// Note: BCJ2 requires special handling in SevenZipParser due to 4-stream architecture\nregisterCodec(CodecId.BCJ2, {\n decode: decodeBcj2,\n createDecoder: createBcj2Decoder,\n});\n\n// Note: PPMd codec is not implemented. See FUTURE_ENHANCEMENTS.md\n"],"names":["CodecId","createCodedError","ErrorCode","createAesDecoder","decodeAes","getPassword","setPassword","createBcjDecoder","decodeBcj","createBcj2Decoder","decodeBcj2","decodeBcj2Multi","createBcjArmDecoder","decodeBcjArm","createBcjArm64Decoder","decodeBcjArm64","createBcjArmtDecoder","decodeBcjArmt","createBcjIa64Decoder","decodeBcjIa64","createBcjPpcDecoder","decodeBcjPpc","createBcjSparcDecoder","decodeBcjSparc","createBzip2Decoder","decodeBzip2","createCopyDecoder","decodeCopy","createDeflateDecoder","decodeDeflate","createDeltaDecoder","decodeDelta","createLzmaDecoder","decodeLzma","createLzma2Decoder","decodeLzma2","codecs","codecIdToKey","id","parts","i","length","push","toString","toUpperCase","join","codecIdEquals","a","b","registerCodec","codec","getCodec","key","UNSUPPORTED_CODEC","isCodecSupported","undefined","getCodecName","COPY","LZMA","LZMA2","BCJ_X86","BCJ_ARM","BCJ_ARMT","BCJ_ARM64","BCJ_PPC","BCJ_IA64","BCJ_SPARC","BCJ2","PPMD","DELTA","DEFLATE","BZIP2","AES","isBcj2Codec","decode","createDecoder"],"mappings":"AAAA,sCAAsC;AACtC,2EAA2E;AAG3E,SAASA,OAAO,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,kBAAkB;AACvE,SAASC,gBAAgB,EAAEC,SAAS,EAAEC,WAAW,EAAEC,WAAW,QAAQ,WAAW;AACjF,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,WAAW;AACvD,SAASC,iBAAiB,EAAEC,UAAU,EAAEC,eAAe,QAAQ,YAAY;AAC3E,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,cAAc;AAChE,SAASC,qBAAqB,EAAEC,cAAc,QAAQ,gBAAgB;AACtE,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,eAAe;AACnE,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,eAAe;AACnE,SAASC,mBAAmB,EAAEC,YAAY,QAAQ,cAAc;AAChE,SAASC,qBAAqB,EAAEC,cAAc,QAAQ,gBAAgB;AACtE,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,aAAa;AAC7D,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,YAAY;AAC1D,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,eAAe;AACnE,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,aAAa;AAC7D,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,YAAY;AAC1D,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,aAAa;AAE7D,8CAA8C;AAC9C,SAAS9B,WAAW,EAAEC,WAAW,GAAG;AAOpC,+BAA+B;AAC/B,MAAM8B,SAAmC,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RmE,eAAepE;AACjB;AAEA,mBAAmB;AACnB0C,cAAcjD,QAAQ6D,OAAO,EAAE;IAC7Ba,QAAQ7D;IACR8D,eAAe/D;AACjB;AAEA,yBAAyB;AACzBqC,cAAcjD,QAAQ8D,QAAQ,EAAE;IAC9BY,QAAQzD;IACR0D,eAAe3D;AACjB;AAEA,qBAAqB;AACrBiC,cAAcjD,QAAQ+D,SAAS,EAAE;IAC/BW,QAAQ3D;IACR4D,eAAe7D;AACjB;AAEA,uBAAuB;AACvBmC,cAAcjD,QAAQgE,OAAO,EAAE;IAC7BU,QAAQrD;IACRsD,eAAevD;AACjB;AAEA,oBAAoB;AACpB6B,cAAcjD,QAAQiE,QAAQ,EAAE;IAC9BS,QAAQvD;IACRwD,eAAezD;AACjB;AAEA,qBAAqB;AACrB+B,cAAcjD,QAAQkE,SAAS,EAAE;IAC/BQ,QAAQnD;IACRoD,eAAerD;AACjB;AAEA,eAAe;AACf2B,cAAcjD,QAAQqE,KAAK,EAAE;IAC3BK,QAAQ3C;IACR4C,eAAe7C;AACjB;AAEA,gBAAgB;AAChBmB,cAAcjD,QAAQsE,OAAO,EAAE;IAC7BI,QAAQ7C;IACR8C,eAAe/C;AACjB;AAEA,cAAc;AACdqB,cAAcjD,QAAQuE,KAAK,EAAE;IAC3BG,QAAQjD;IACRkD,eAAenD;AACjB;AAEA,iCAAiC;AACjCyB,cAAcjD,QAAQwE,GAAG,EAAE;IACzBE,QAAQtE;IACRuE,eAAexE;AACjB;AAEA,sCAAsC;AACtC,sFAAsF;AACtF8C,cAAcjD,QAAQmE,IAAI,EAAE;IAC1BO,QAAQhE;IACRiE,eAAelE;AACjB,IAEA,kEAAkE"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/index.ts"],"sourcesContent":["// Codec registry for 7z decompression\n// Each codec provides a decode function and optionally a streaming decoder\n\nimport type { Transform } from 'stream';\nimport {\n createLzma2Decoder as _createLzma2Decoder,\n createLzmaDecoder as _createLzmaDecoder,\n createBcjArm64Decoder,\n createBcjArmDecoder,\n createBcjArmtDecoder,\n createBcjDecoder,\n createBcjIa64Decoder,\n createBcjPpcDecoder,\n createBcjSparcDecoder,\n createDeltaDecoder,\n decode7zLzma,\n decode7zLzma2,\n decodeBcj,\n decodeBcjArm,\n decodeBcjArm64,\n decodeBcjArmt,\n decodeBcjIa64,\n decodeBcjPpc,\n decodeBcjSparc,\n decodeDelta,\n} from 'xz-compat';\nimport { CodecId, createCodedError, ErrorCode } from '../constants.ts';\nimport { createAesDecoder, decodeAes, getPassword, setPassword } from './Aes.ts';\nimport { createBcj2Decoder, decodeBcj2, decodeBcj2Multi } from './Bcj2.ts';\nimport { createBzip2Decoder, decodeBzip2 } from './BZip2.ts';\nimport { createCopyDecoder, decodeCopy } from './Copy.ts';\nimport { createDeflateDecoder, decodeDeflate } from './Deflate.ts';\n\n// Re-export password functions for API access\nexport { getPassword, setPassword };\n\nexport interface Codec {\n decode: (input: Buffer, properties?: Buffer, unpackSize?: number) => Buffer;\n createDecoder: (properties?: Buffer, unpackSize?: number) => Transform;\n}\n\n// Simple wrappers with validation that use xz-compat's optimized decode7zLjma/decode7zLzma2\nfunction decodeLzma(input: Buffer, properties?: Buffer, unpackSize?: number): Buffer {\n if (!properties || properties.length < 5) {\n throw new Error('LZMA requires 5-byte properties');\n }\n if (typeof unpackSize !== 'number' || unpackSize < 0) {\n throw new Error('LZMA requires known unpack size');\n }\n return decode7zLzma(input, properties, unpackSize);\n}\n\nfunction createLzmaDecoder(properties?: Buffer, unpackSize?: number): Transform {\n if (!properties || properties.length < 5) {\n throw new Error('LZMA requires 5-byte properties');\n }\n if (typeof unpackSize !== 'number' || unpackSize < 0) {\n throw new Error('LZMA requires known unpack size');\n }\n return _createLzmaDecoder(properties, unpackSize) as Transform;\n}\n\nfunction decodeLzma2(input: Buffer, properties?: Buffer, unpackSize?: number): Buffer {\n if (!properties || properties.length < 1) {\n throw new Error('LZMA2 requires properties byte');\n }\n return decode7zLzma2(input, properties, unpackSize);\n}\n\nfunction createLzma2Decoder(properties?: Buffer, _unpackSize?: number): Transform {\n if (!properties || properties.length < 1) {\n throw new Error('LZMA2 requires properties byte');\n }\n return _createLzma2Decoder(properties) as Transform;\n}\n\n// Registry of supported codecs\nconst codecs: { [key: string]: Codec } = {};\n\n/**\n * Convert codec ID bytes to a string key\n */\nfunction codecIdToKey(id: number[]): string {\n const parts: string[] = [];\n for (let i = 0; i < id.length; i++) {\n parts.push(id[i].toString(16).toUpperCase());\n }\n return parts.join('-');\n}\n\n/**\n * Check if two codec IDs match\n */\nfunction codecIdEquals(a: number[], b: number[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * Register a codec\n */\nexport function registerCodec(id: number[], codec: Codec): void {\n codecs[codecIdToKey(id)] = codec;\n}\n\n/**\n * Get a codec by ID\n * @throws Error if codec is not supported\n */\nexport function getCodec(id: number[]): Codec {\n const key = codecIdToKey(id);\n const codec = codecs[key];\n if (!codec) {\n throw createCodedError(`Unsupported codec: ${key}`, ErrorCode.UNSUPPORTED_CODEC);\n }\n return codec;\n}\n\n/**\n * Check if a codec is supported\n */\nexport function isCodecSupported(id: number[]): boolean {\n return codecs[codecIdToKey(id)] !== undefined;\n}\n\n/**\n * Get human-readable codec name\n */\nexport function getCodecName(id: number[]): string {\n if (codecIdEquals(id, CodecId.COPY)) return 'Copy';\n if (codecIdEquals(id, CodecId.LZMA)) return 'LZMA';\n if (codecIdEquals(id, CodecId.LZMA2)) return 'LZMA2';\n if (codecIdEquals(id, CodecId.BCJ_X86)) return 'BCJ (x86)';\n if (codecIdEquals(id, CodecId.BCJ_ARM)) return 'BCJ (ARM)';\n if (codecIdEquals(id, CodecId.BCJ_ARMT)) return 'BCJ (ARM Thumb)';\n if (codecIdEquals(id, CodecId.BCJ_ARM64)) return 'BCJ (ARM64)';\n if (codecIdEquals(id, CodecId.BCJ_PPC)) return 'BCJ (PowerPC)';\n if (codecIdEquals(id, CodecId.BCJ_IA64)) return 'BCJ (IA64)';\n if (codecIdEquals(id, CodecId.BCJ_SPARC)) return 'BCJ (SPARC)';\n if (codecIdEquals(id, CodecId.BCJ2)) return 'BCJ2';\n if (codecIdEquals(id, CodecId.PPMD)) return 'PPMd';\n if (codecIdEquals(id, CodecId.DELTA)) return 'Delta';\n if (codecIdEquals(id, CodecId.DEFLATE)) return 'Deflate';\n if (codecIdEquals(id, CodecId.BZIP2)) return 'BZip2';\n if (codecIdEquals(id, CodecId.AES)) return 'AES-256';\n return `Unknown (${codecIdToKey(id)})`;\n}\n\n/**\n * Check if a codec ID matches BCJ2\n */\nexport function isBcj2Codec(id: number[]): boolean {\n return codecIdEquals(id, CodecId.BCJ2);\n}\n\n// Re-export BCJ2 multi-stream decoder for special handling\nexport { decodeBcj2Multi };\n\n// Register built-in codecs\n\n// Copy codec (no compression)\nregisterCodec(CodecId.COPY, {\n decode: decodeCopy,\n createDecoder: createCopyDecoder,\n});\n\n// LZMA codec\nregisterCodec(CodecId.LZMA, {\n decode: decodeLzma,\n createDecoder: createLzmaDecoder,\n});\n\n// LZMA2 codec\nregisterCodec(CodecId.LZMA2, {\n decode: decodeLzma2,\n createDecoder: createLzma2Decoder,\n});\n\n// BCJ (x86) filter\nregisterCodec(CodecId.BCJ_X86, {\n decode: decodeBcj,\n createDecoder: createBcjDecoder,\n});\n\n// BCJ (ARM) filter\nregisterCodec(CodecId.BCJ_ARM, {\n decode: decodeBcjArm,\n createDecoder: createBcjArmDecoder,\n});\n\n// BCJ (ARM Thumb) filter\nregisterCodec(CodecId.BCJ_ARMT, {\n decode: decodeBcjArmt,\n createDecoder: createBcjArmtDecoder,\n});\n\n// BCJ (ARM64) filter\nregisterCodec(CodecId.BCJ_ARM64, {\n decode: decodeBcjArm64,\n createDecoder: createBcjArm64Decoder,\n});\n\n// BCJ (PowerPC) filter\nregisterCodec(CodecId.BCJ_PPC, {\n decode: decodeBcjPpc,\n createDecoder: createBcjPpcDecoder,\n});\n\n// BCJ (IA64) filter\nregisterCodec(CodecId.BCJ_IA64, {\n decode: decodeBcjIa64,\n createDecoder: createBcjIa64Decoder,\n});\n\n// BCJ (SPARC) filter\nregisterCodec(CodecId.BCJ_SPARC, {\n decode: decodeBcjSparc,\n createDecoder: createBcjSparcDecoder,\n});\n\n// Delta filter\nregisterCodec(CodecId.DELTA, {\n decode: decodeDelta,\n createDecoder: createDeltaDecoder,\n});\n\n// Deflate codec\nregisterCodec(CodecId.DEFLATE, {\n decode: decodeDeflate,\n createDecoder: createDeflateDecoder,\n});\n\n// BZip2 codec\nregisterCodec(CodecId.BZIP2, {\n decode: decodeBzip2,\n createDecoder: createBzip2Decoder,\n});\n\n// AES-256-CBC codec (encryption)\nregisterCodec(CodecId.AES, {\n decode: decodeAes,\n createDecoder: createAesDecoder,\n});\n\n// BCJ2 (x86-64) filter - multi-stream\n// Note: BCJ2 requires special handling in SevenZipParser due to 4-stream architecture\nregisterCodec(CodecId.BCJ2, {\n decode: decodeBcj2,\n createDecoder: createBcj2Decoder,\n});\n\n// Note: PPMd codec is not implemented. See FUTURE_ENHANCEMENTS.md\n"],"names":["createLzma2Decoder","_createLzma2Decoder","createLzmaDecoder","_createLzmaDecoder","createBcjArm64Decoder","createBcjArmDecoder","createBcjArmtDecoder","createBcjDecoder","createBcjIa64Decoder","createBcjPpcDecoder","createBcjSparcDecoder","createDeltaDecoder","decode7zLzma","decode7zLzma2","decodeBcj","decodeBcjArm","decodeBcjArm64","decodeBcjArmt","decodeBcjIa64","decodeBcjPpc","decodeBcjSparc","decodeDelta","CodecId","createCodedError","ErrorCode","createAesDecoder","decodeAes","getPassword","setPassword","createBcj2Decoder","decodeBcj2","decodeBcj2Multi","createBzip2Decoder","decodeBzip2","createCopyDecoder","decodeCopy","createDeflateDecoder","decodeDeflate","decodeLzma","input","properties","unpackSize","length","Error","decodeLzma2","_unpackSize","codecs","codecIdToKey","id","parts","i","push","toString","toUpperCase","join","codecIdEquals","a","b","registerCodec","codec","getCodec","key","UNSUPPORTED_CODEC","isCodecSupported","undefined","getCodecName","COPY","LZMA","LZMA2","BCJ_X86","BCJ_ARM","BCJ_ARMT","BCJ_ARM64","BCJ_PPC","BCJ_IA64","BCJ_SPARC","BCJ2","PPMD","DELTA","DEFLATE","BZIP2","AES","isBcj2Codec","decode","createDecoder"],"mappings":"AAAA,sCAAsC;AACtC,2EAA2E;AAG3E,SACEA,sBAAsBC,mBAAmB,EACzCC,qBAAqBC,kBAAkB,EACvCC,qBAAqB,EACrBC,mBAAmB,EACnBC,oBAAoB,EACpBC,gBAAgB,EAChBC,oBAAoB,EACpBC,mBAAmB,EACnBC,qBAAqB,EACrBC,kBAAkB,EAClBC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,YAAY,EACZC,cAAc,EACdC,aAAa,EACbC,aAAa,EACbC,YAAY,EACZC,cAAc,EACdC,WAAW,QACN,YAAY;AACnB,SAASC,OAAO,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,kBAAkB;AACvE,SAASC,gBAAgB,EAAEC,SAAS,EAAEC,WAAW,EAAEC,WAAW,QAAQ,WAAW;AACjF,SAASC,iBAAiB,EAAEC,UAAU,EAAEC,eAAe,QAAQ,YAAY;AAC3E,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,aAAa;AAC7D,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,YAAY;AAC1D,SAASC,oBAAoB,EAAEC,aAAa,QAAQ,eAAe;AAEnE,8CAA8C;AAC9C,SAASV,WAAW,EAAEC,WAAW,GAAG;AAOpC,4FAA4F;AAC5F,SAASU,WAAWC,KAAa,EAAEC,UAAmB,EAAEC,UAAmB;IACzE,IAAI,CAACD,cAAcA,WAAWE,MAAM,GAAG,GAAG;QACxC,MAAM,IAAIC,MAAM;IAClB;IACA,IAAI,OAAOF,eAAe,YAAYA,aAAa,GAAG;QACpD,MAAM,IAAIE,MAAM;IAClB;IACA,OAAO/B,aA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AEA,eAAe;AACfgD,cAAcpC,QAAQwD,KAAK,EAAE;IAC3BK,QAAQ9D;IACR+D,eAAezE;AACjB;AAEA,gBAAgB;AAChB+C,cAAcpC,QAAQyD,OAAO,EAAE;IAC7BI,QAAQ9C;IACR+C,eAAehD;AACjB;AAEA,cAAc;AACdsB,cAAcpC,QAAQ0D,KAAK,EAAE;IAC3BG,QAAQlD;IACRmD,eAAepD;AACjB;AAEA,iCAAiC;AACjC0B,cAAcpC,QAAQ2D,GAAG,EAAE;IACzBE,QAAQzD;IACR0D,eAAe3D;AACjB;AAEA,sCAAsC;AACtC,sFAAsF;AACtFiC,cAAcpC,QAAQsD,IAAI,EAAE;IAC1BO,QAAQrD;IACRsD,eAAevD;AACjB,IAEA,kEAAkE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "7z-iterator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Extract contents from 7z archives using an iterator API. Pure JavaScript, works on Node.js 0.8+",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extract",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"call-once-fn": "^1.1.6",
|
|
57
57
|
"extract-base-iterator": "^3.0.0",
|
|
58
58
|
"fs-remove-compat": "^1.0.0",
|
|
59
|
-
"lodash.compact": "^3.0.1",
|
|
60
59
|
"mkdirp-classic": "^0.5.2",
|
|
61
60
|
"on-one": "^1.0.10",
|
|
62
61
|
"os-shim": "^0.1.3",
|
|
63
62
|
"queue-cb": "^1.0.0",
|
|
64
63
|
"short-hash": "^1.0.0",
|
|
65
64
|
"temp-suffix": "^1.0.10",
|
|
66
|
-
"unbzip2-stream": "1.0.8"
|
|
65
|
+
"unbzip2-stream": "1.0.8",
|
|
66
|
+
"xz-compat": "^0.2.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/mocha": "*",
|