7z-iterator 0.1.9 → 0.1.10
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.
|
@@ -35,15 +35,20 @@ function _interop_require_default(obj) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
38
|
-
// Try to load lzma-native
|
|
38
|
+
// Try to load lzma-native (only on Node 10+ where ES6 class syntax is supported)
|
|
39
|
+
// Note: We must check the version BEFORE requiring because syntax errors during
|
|
40
|
+
// module parsing cannot be caught by try/catch
|
|
39
41
|
var lzmaNative = null;
|
|
40
42
|
var _hasNativeLzmaLib = false;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
var major = +process.versions.node.split('.')[0];
|
|
44
|
+
if (major >= 10) {
|
|
45
|
+
try {
|
|
46
|
+
lzmaNative = _require('lzma-native');
|
|
47
|
+
// Verify rawDecoder support
|
|
48
|
+
_hasNativeLzmaLib = lzmaNative !== null && typeof lzmaNative.createStream === 'function';
|
|
49
|
+
} catch (_e) {
|
|
50
|
+
// lzma-native not available - will use lzma-purejs
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
var hasNativeLzma = _hasNativeLzmaLib;
|
|
49
54
|
function createNativeLzma2Decoder(dictSize) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/lzmaCompat.ts"],"sourcesContent":["/**\n * LZMA compatibility layer - uses native lzma when available, falls back to lzma-purejs\n *\n * lzma-native provides native liblzma bindings with rawDecoder support.\n * This gives significant performance improvements on Node.js 8+ while\n * maintaining compatibility with Node.js 0.8+ via lzma-purejs fallback.\n *\n * The native decoder uses Node.js streams which integrate naturally with\n * the callback-based async pattern used throughout the iterator libraries.\n */\n\nimport Module from 'module';\nimport type { Transform } from 'readable-stream';\n\nvar _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n// Try to load lzma-native\nvar lzmaNative: typeof import('lzma-native') | null = null;\nvar _hasNativeLzmaLib = false;\n\
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/lzmaCompat.ts"],"sourcesContent":["/**\n * LZMA compatibility layer - uses native lzma when available, falls back to lzma-purejs\n *\n * lzma-native provides native liblzma bindings with rawDecoder support.\n * This gives significant performance improvements on Node.js 8+ while\n * maintaining compatibility with Node.js 0.8+ via lzma-purejs fallback.\n *\n * The native decoder uses Node.js streams which integrate naturally with\n * the callback-based async pattern used throughout the iterator libraries.\n */\n\nimport Module from 'module';\nimport type { Transform } from 'readable-stream';\n\nvar _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n// Try to load lzma-native (only on Node 10+ where ES6 class syntax is supported)\n// Note: We must check the version BEFORE requiring because syntax errors during\n// module parsing cannot be caught by try/catch\nvar lzmaNative: typeof import('lzma-native') | null = null;\nvar _hasNativeLzmaLib = false;\nvar major = +process.versions.node.split('.')[0];\n\nif (major >= 10) {\n try {\n lzmaNative = _require('lzma-native');\n // Verify rawDecoder support\n _hasNativeLzmaLib = lzmaNative !== null && typeof lzmaNative.createStream === 'function';\n } catch (_e) {\n // lzma-native not available - will use lzma-purejs\n }\n}\n\n// Export whether native lzma is available for streaming\nexport var hasNativeLzma = _hasNativeLzmaLib;\n\n/**\n * Create a native LZMA2 decoder stream\n * Returns a Transform stream that decodes LZMA2 data\n *\n * @param dictSize - Dictionary size\n * @returns Transform stream for decoding, or null if native not available\n */\nexport function createNativeLzma2Decoder(dictSize?: number): Transform | null {\n if (!lzmaNative) {\n return null;\n }\n\n var filterOpts: { id: string; dict_size?: number } = {\n id: lzmaNative.FILTER_LZMA2,\n };\n\n if (dictSize !== undefined) {\n filterOpts.dict_size = dictSize;\n }\n\n return lzmaNative.createStream('rawDecoder', {\n filters: [filterOpts],\n }) as unknown as Transform;\n}\n\n/**\n * Create a native LZMA1 decoder stream\n * Returns a Transform stream that decodes LZMA1 data\n *\n * Note: Native LZMA1 decoder disabled due to LZMA_BUF_ERROR issues with\n * lzma-native's rawDecoder for LZMA1. Falls back to lzma-purejs which\n * handles 7z's LZMA1 format correctly. LZMA2 native works fine.\n *\n * @param _lc - Literal context bits (0-8)\n * @param _lp - Literal position bits (0-4)\n * @param _pb - Position bits (0-4)\n * @param _dictSize - Dictionary size\n * @returns null - always falls back to pure JS decoder\n */\nexport function createNativeLzma1Decoder(_lc: number, _lp: number, _pb: number, _dictSize: number): Transform | null {\n // Native LZMA1 disabled - lzma-native's rawDecoder has issues with 7z's LZMA1 format\n // (LZMA_BUF_ERROR: No progress is possible)\n // LZMA2 native works correctly and is more common in modern 7z files\n return null;\n}\n"],"names":["createNativeLzma1Decoder","createNativeLzma2Decoder","hasNativeLzma","_require","require","Module","createRequire","lzmaNative","_hasNativeLzmaLib","major","process","versions","node","split","createStream","_e","dictSize","filterOpts","id","FILTER_LZMA2","undefined","dict_size","filters","_lc","_lp","_pb","_dictSize"],"mappings":"AAAA;;;;;;;;;CASC;;;;;;;;;;;QAkEeA;eAAAA;;QAhCAC;eAAAA;;QATLC;eAAAA;;;6DAvBQ;;;;;;AAGnB,IAAIC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAExF,iFAAiF;AACjF,gFAAgF;AAChF,+CAA+C;AAC/C,IAAIG,aAAkD;AACtD,IAAIC,oBAAoB;AACxB,IAAIC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAEhD,IAAIJ,SAAS,IAAI;IACf,IAAI;QACFF,aAAaJ,SAAS;QACtB,4BAA4B;QAC5BK,oBAAoBD,eAAe,QAAQ,OAAOA,WAAWO,YAAY,KAAK;IAChF,EAAE,OAAOC,IAAI;IACX,mDAAmD;IACrD;AACF;AAGO,IAAIb,gBAAgBM;AASpB,SAASP,yBAAyBe,QAAiB;IACxD,IAAI,CAACT,YAAY;QACf,OAAO;IACT;IAEA,IAAIU,aAAiD;QACnDC,IAAIX,WAAWY,YAAY;IAC7B;IAEA,IAAIH,aAAaI,WAAW;QAC1BH,WAAWI,SAAS,GAAGL;IACzB;IAEA,OAAOT,WAAWO,YAAY,CAAC,cAAc;QAC3CQ,SAAS;YAACL;SAAW;IACvB;AACF;AAgBO,SAASjB,yBAAyBuB,GAAW,EAAEC,GAAW,EAAEC,GAAW,EAAEC,SAAiB;IAC/F,qFAAqF;IACrF,4CAA4C;IAC5C,qEAAqE;IACrE,OAAO;AACT"}
|
|
@@ -9,15 +9,20 @@
|
|
|
9
9
|
* the callback-based async pattern used throughout the iterator libraries.
|
|
10
10
|
*/ import Module from 'module';
|
|
11
11
|
var _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
12
|
-
// Try to load lzma-native
|
|
12
|
+
// Try to load lzma-native (only on Node 10+ where ES6 class syntax is supported)
|
|
13
|
+
// Note: We must check the version BEFORE requiring because syntax errors during
|
|
14
|
+
// module parsing cannot be caught by try/catch
|
|
13
15
|
var lzmaNative = null;
|
|
14
16
|
var _hasNativeLzmaLib = false;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
var major = +process.versions.node.split('.')[0];
|
|
18
|
+
if (major >= 10) {
|
|
19
|
+
try {
|
|
20
|
+
lzmaNative = _require('lzma-native');
|
|
21
|
+
// Verify rawDecoder support
|
|
22
|
+
_hasNativeLzmaLib = lzmaNative !== null && typeof lzmaNative.createStream === 'function';
|
|
23
|
+
} catch (_e) {
|
|
24
|
+
// lzma-native not available - will use lzma-purejs
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
// Export whether native lzma is available for streaming
|
|
23
28
|
export var hasNativeLzma = _hasNativeLzmaLib;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/lzmaCompat.ts"],"sourcesContent":["/**\n * LZMA compatibility layer - uses native lzma when available, falls back to lzma-purejs\n *\n * lzma-native provides native liblzma bindings with rawDecoder support.\n * This gives significant performance improvements on Node.js 8+ while\n * maintaining compatibility with Node.js 0.8+ via lzma-purejs fallback.\n *\n * The native decoder uses Node.js streams which integrate naturally with\n * the callback-based async pattern used throughout the iterator libraries.\n */\n\nimport Module from 'module';\nimport type { Transform } from 'readable-stream';\n\nvar _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n// Try to load lzma-native\nvar lzmaNative: typeof import('lzma-native') | null = null;\nvar _hasNativeLzmaLib = false;\n\
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/lzmaCompat.ts"],"sourcesContent":["/**\n * LZMA compatibility layer - uses native lzma when available, falls back to lzma-purejs\n *\n * lzma-native provides native liblzma bindings with rawDecoder support.\n * This gives significant performance improvements on Node.js 8+ while\n * maintaining compatibility with Node.js 0.8+ via lzma-purejs fallback.\n *\n * The native decoder uses Node.js streams which integrate naturally with\n * the callback-based async pattern used throughout the iterator libraries.\n */\n\nimport Module from 'module';\nimport type { Transform } from 'readable-stream';\n\nvar _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n// Try to load lzma-native (only on Node 10+ where ES6 class syntax is supported)\n// Note: We must check the version BEFORE requiring because syntax errors during\n// module parsing cannot be caught by try/catch\nvar lzmaNative: typeof import('lzma-native') | null = null;\nvar _hasNativeLzmaLib = false;\nvar major = +process.versions.node.split('.')[0];\n\nif (major >= 10) {\n try {\n lzmaNative = _require('lzma-native');\n // Verify rawDecoder support\n _hasNativeLzmaLib = lzmaNative !== null && typeof lzmaNative.createStream === 'function';\n } catch (_e) {\n // lzma-native not available - will use lzma-purejs\n }\n}\n\n// Export whether native lzma is available for streaming\nexport var hasNativeLzma = _hasNativeLzmaLib;\n\n/**\n * Create a native LZMA2 decoder stream\n * Returns a Transform stream that decodes LZMA2 data\n *\n * @param dictSize - Dictionary size\n * @returns Transform stream for decoding, or null if native not available\n */\nexport function createNativeLzma2Decoder(dictSize?: number): Transform | null {\n if (!lzmaNative) {\n return null;\n }\n\n var filterOpts: { id: string; dict_size?: number } = {\n id: lzmaNative.FILTER_LZMA2,\n };\n\n if (dictSize !== undefined) {\n filterOpts.dict_size = dictSize;\n }\n\n return lzmaNative.createStream('rawDecoder', {\n filters: [filterOpts],\n }) as unknown as Transform;\n}\n\n/**\n * Create a native LZMA1 decoder stream\n * Returns a Transform stream that decodes LZMA1 data\n *\n * Note: Native LZMA1 decoder disabled due to LZMA_BUF_ERROR issues with\n * lzma-native's rawDecoder for LZMA1. Falls back to lzma-purejs which\n * handles 7z's LZMA1 format correctly. LZMA2 native works fine.\n *\n * @param _lc - Literal context bits (0-8)\n * @param _lp - Literal position bits (0-4)\n * @param _pb - Position bits (0-4)\n * @param _dictSize - Dictionary size\n * @returns null - always falls back to pure JS decoder\n */\nexport function createNativeLzma1Decoder(_lc: number, _lp: number, _pb: number, _dictSize: number): Transform | null {\n // Native LZMA1 disabled - lzma-native's rawDecoder has issues with 7z's LZMA1 format\n // (LZMA_BUF_ERROR: No progress is possible)\n // LZMA2 native works correctly and is more common in modern 7z files\n return null;\n}\n"],"names":["Module","_require","require","createRequire","url","lzmaNative","_hasNativeLzmaLib","major","process","versions","node","split","createStream","_e","hasNativeLzma","createNativeLzma2Decoder","dictSize","filterOpts","id","FILTER_LZMA2","undefined","dict_size","filters","createNativeLzma1Decoder","_lc","_lp","_pb","_dictSize"],"mappings":"AAAA;;;;;;;;;CASC,GAED,OAAOA,YAAY,SAAS;AAG5B,IAAIC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAExF,iFAAiF;AACjF,gFAAgF;AAChF,+CAA+C;AAC/C,IAAIG,aAAkD;AACtD,IAAIC,oBAAoB;AACxB,IAAIC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAEhD,IAAIJ,SAAS,IAAI;IACf,IAAI;QACFF,aAAaJ,SAAS;QACtB,4BAA4B;QAC5BK,oBAAoBD,eAAe,QAAQ,OAAOA,WAAWO,YAAY,KAAK;IAChF,EAAE,OAAOC,IAAI;IACX,mDAAmD;IACrD;AACF;AAEA,wDAAwD;AACxD,OAAO,IAAIC,gBAAgBR,kBAAkB;AAE7C;;;;;;CAMC,GACD,OAAO,SAASS,yBAAyBC,QAAiB;IACxD,IAAI,CAACX,YAAY;QACf,OAAO;IACT;IAEA,IAAIY,aAAiD;QACnDC,IAAIb,WAAWc,YAAY;IAC7B;IAEA,IAAIH,aAAaI,WAAW;QAC1BH,WAAWI,SAAS,GAAGL;IACzB;IAEA,OAAOX,WAAWO,YAAY,CAAC,cAAc;QAC3CU,SAAS;YAACL;SAAW;IACvB;AACF;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASM,yBAAyBC,GAAW,EAAEC,GAAW,EAAEC,GAAW,EAAEC,SAAiB;IAC/F,qFAAqF;IACrF,4CAA4C;IAC5C,qEAAqE;IACrE,OAAO;AACT"}
|