7z-iterator 1.0.1 → 1.0.2

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.
@@ -1,14 +1,15 @@
1
1
  import type { Transform } from 'readable-stream';
2
2
  /**
3
- * Decode BZip2 compressed data
3
+ * Decode BZip2 compressed data synchronously
4
4
  *
5
5
  * @param input - BZip2 compressed data (with BZh header)
6
6
  * @param _properties - Unused for BZip2
7
- * @param _unpackSize - Unused for seek-bzip
7
+ * @param _unpackSize - Unused
8
8
  * @returns Decompressed data
9
9
  */
10
10
  export declare function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer;
11
11
  /**
12
12
  * Create a BZip2 decoder Transform stream
13
+ * Uses unbzip2-stream for true streaming decompression (block by block)
13
14
  */
14
- export declare function createBzip2Decoder(properties?: Buffer, unpackSize?: number): Transform;
15
+ export declare function createBzip2Decoder(_properties?: Buffer, _unpackSize?: number): Transform;
@@ -1,14 +1,15 @@
1
1
  import type { Transform } from 'readable-stream';
2
2
  /**
3
- * Decode BZip2 compressed data
3
+ * Decode BZip2 compressed data synchronously
4
4
  *
5
5
  * @param input - BZip2 compressed data (with BZh header)
6
6
  * @param _properties - Unused for BZip2
7
- * @param _unpackSize - Unused for seek-bzip
7
+ * @param _unpackSize - Unused
8
8
  * @returns Decompressed data
9
9
  */
10
10
  export declare function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer;
11
11
  /**
12
12
  * Create a BZip2 decoder Transform stream
13
+ * Uses unbzip2-stream for true streaming decompression (block by block)
13
14
  */
14
- export declare function createBzip2Decoder(properties?: Buffer, unpackSize?: number): Transform;
15
+ export declare function createBzip2Decoder(_properties?: Buffer, _unpackSize?: number): Transform;
@@ -1,7 +1,7 @@
1
1
  // BZip2 codec - bzip2 compression
2
2
  // 7z stores bzip2 data with the standard BZh header
3
3
  //
4
- // Uses seek-bzip for decompression (pure JavaScript)
4
+ // Uses unbzip2-stream's internal bzip2 library for both sync and streaming decompression
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
@@ -20,18 +20,22 @@ _export(exports, {
20
20
  return decodeBzip2;
21
21
  }
22
22
  });
23
- var _seekbzip = /*#__PURE__*/ _interop_require_default(require("seek-bzip"));
24
- var _createBufferingDecoderts = /*#__PURE__*/ _interop_require_default(require("./createBufferingDecoder.js"));
23
+ var _extractbaseiterator = require("extract-base-iterator");
24
+ var _unbzip2stream = /*#__PURE__*/ _interop_require_default(require("unbzip2-stream"));
25
+ var _bzip2 = /*#__PURE__*/ _interop_require_default(require("unbzip2-stream/lib/bzip2.js"));
25
26
  function _interop_require_default(obj) {
26
27
  return obj && obj.__esModule ? obj : {
27
28
  default: obj
28
29
  };
29
30
  }
30
31
  function decodeBzip2(input, _properties, _unpackSize) {
31
- // seek-bzip.decode(input, output) - returns output buffer
32
- return _seekbzip.default.decode(input);
32
+ var chunks = [];
33
+ _bzip2.default.simple(_bzip2.default.array(input), function(byte) {
34
+ chunks.push(byte);
35
+ });
36
+ return (0, _extractbaseiterator.bufferFrom)(chunks);
33
37
  }
34
- function createBzip2Decoder(properties, unpackSize) {
35
- return (0, _createBufferingDecoderts.default)(decodeBzip2, properties, unpackSize);
38
+ function createBzip2Decoder(_properties, _unpackSize) {
39
+ return (0, _unbzip2stream.default)();
36
40
  }
37
41
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/BZip2.ts"],"sourcesContent":["// BZip2 codec - bzip2 compression\n// 7z stores bzip2 data with the standard BZh header\n//\n// Uses seek-bzip for decompression (pure JavaScript)\n\nimport type { Transform } from 'readable-stream';\nimport Bunzip from 'seek-bzip';\nimport createBufferingDecoder from './createBufferingDecoder.ts';\n\n/**\n * Decode BZip2 compressed data\n *\n * @param input - BZip2 compressed data (with BZh header)\n * @param _properties - Unused for BZip2\n * @param _unpackSize - Unused for seek-bzip\n * @returns Decompressed data\n */\nexport function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer {\n // seek-bzip.decode(input, output) - returns output buffer\n return Bunzip.decode(input);\n}\n\n/**\n * Create a BZip2 decoder Transform stream\n */\nexport function createBzip2Decoder(properties?: Buffer, unpackSize?: number): Transform {\n return createBufferingDecoder(decodeBzip2, properties, unpackSize);\n}\n"],"names":["createBzip2Decoder","decodeBzip2","input","_properties","_unpackSize","Bunzip","decode","properties","unpackSize","createBufferingDecoder"],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AACpD,EAAE;AACF,qDAAqD;;;;;;;;;;;;QAsBrCA;eAAAA;;QARAC;eAAAA;;;+DAXG;+EACgB;;;;;;AAU5B,SAASA,YAAYC,KAAa,EAAEC,WAAoB,EAAEC,WAAoB;IACnF,0DAA0D;IAC1D,OAAOC,iBAAM,CAACC,MAAM,CAACJ;AACvB;AAKO,SAASF,mBAAmBO,UAAmB,EAAEC,UAAmB;IACzE,OAAOC,IAAAA,iCAAsB,EAACR,aAAaM,YAAYC;AACzD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/BZip2.ts"],"sourcesContent":["// BZip2 codec - bzip2 compression\n// 7z stores bzip2 data with the standard BZh header\n//\n// Uses unbzip2-stream's internal bzip2 library for both sync and streaming decompression\n\nimport { bufferFrom } from 'extract-base-iterator';\nimport type { Transform } from 'readable-stream';\nimport unbzip2Stream from 'unbzip2-stream';\n\n// Access the internal bzip2 decoder from unbzip2-stream\nimport bzip2 from 'unbzip2-stream/lib/bzip2.js';\n\n/**\n * Decode BZip2 compressed data synchronously\n *\n * @param input - BZip2 compressed data (with BZh header)\n * @param _properties - Unused for BZip2\n * @param _unpackSize - Unused\n * @returns Decompressed data\n */\nexport function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer {\n const chunks: number[] = [];\n bzip2.simple(bzip2.array(input), (byte: number) => {\n chunks.push(byte);\n });\n return bufferFrom(chunks);\n}\n\n/**\n * Create a BZip2 decoder Transform stream\n * Uses unbzip2-stream for true streaming decompression (block by block)\n */\nexport function createBzip2Decoder(_properties?: Buffer, _unpackSize?: number): Transform {\n return unbzip2Stream() as Transform;\n}\n"],"names":["createBzip2Decoder","decodeBzip2","input","_properties","_unpackSize","chunks","bzip2","simple","array","byte","push","bufferFrom","unbzip2Stream"],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AACpD,EAAE;AACF,yFAAyF;;;;;;;;;;;;QA6BzEA;eAAAA;;QAZAC;eAAAA;;;mCAfW;oEAED;4DAGR;;;;;;AAUX,SAASA,YAAYC,KAAa,EAAEC,WAAoB,EAAEC,WAAoB;IACnF,IAAMC,SAAmB,EAAE;IAC3BC,cAAK,CAACC,MAAM,CAACD,cAAK,CAACE,KAAK,CAACN,QAAQ,SAACO;QAChCJ,OAAOK,IAAI,CAACD;IACd;IACA,OAAOE,IAAAA,+BAAU,EAACN;AACpB;AAMO,SAASL,mBAAmBG,WAAoB,EAAEC,WAAoB;IAC3E,OAAOQ,IAAAA,sBAAa;AACtB"}
@@ -1,14 +1,15 @@
1
1
  import type { Transform } from 'readable-stream';
2
2
  /**
3
- * Decode BZip2 compressed data
3
+ * Decode BZip2 compressed data synchronously
4
4
  *
5
5
  * @param input - BZip2 compressed data (with BZh header)
6
6
  * @param _properties - Unused for BZip2
7
- * @param _unpackSize - Unused for seek-bzip
7
+ * @param _unpackSize - Unused
8
8
  * @returns Decompressed data
9
9
  */
10
10
  export declare function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer;
11
11
  /**
12
12
  * Create a BZip2 decoder Transform stream
13
+ * Uses unbzip2-stream for true streaming decompression (block by block)
13
14
  */
14
- export declare function createBzip2Decoder(properties?: Buffer, unpackSize?: number): Transform;
15
+ export declare function createBzip2Decoder(_properties?: Buffer, _unpackSize?: number): Transform;
@@ -1,22 +1,28 @@
1
1
  // BZip2 codec - bzip2 compression
2
2
  // 7z stores bzip2 data with the standard BZh header
3
3
  //
4
- // Uses seek-bzip for decompression (pure JavaScript)
5
- import Bunzip from 'seek-bzip';
6
- import createBufferingDecoder from './createBufferingDecoder.js';
4
+ // Uses unbzip2-stream's internal bzip2 library for both sync and streaming decompression
5
+ import { bufferFrom } from 'extract-base-iterator';
6
+ import unbzip2Stream from 'unbzip2-stream';
7
+ // Access the internal bzip2 decoder from unbzip2-stream
8
+ import bzip2 from 'unbzip2-stream/lib/bzip2.js';
7
9
  /**
8
- * Decode BZip2 compressed data
10
+ * Decode BZip2 compressed data synchronously
9
11
  *
10
12
  * @param input - BZip2 compressed data (with BZh header)
11
13
  * @param _properties - Unused for BZip2
12
- * @param _unpackSize - Unused for seek-bzip
14
+ * @param _unpackSize - Unused
13
15
  * @returns Decompressed data
14
16
  */ export function decodeBzip2(input, _properties, _unpackSize) {
15
- // seek-bzip.decode(input, output) - returns output buffer
16
- return Bunzip.decode(input);
17
+ const chunks = [];
18
+ bzip2.simple(bzip2.array(input), (byte)=>{
19
+ chunks.push(byte);
20
+ });
21
+ return bufferFrom(chunks);
17
22
  }
18
23
  /**
19
24
  * Create a BZip2 decoder Transform stream
20
- */ export function createBzip2Decoder(properties, unpackSize) {
21
- return createBufferingDecoder(decodeBzip2, properties, unpackSize);
25
+ * Uses unbzip2-stream for true streaming decompression (block by block)
26
+ */ export function createBzip2Decoder(_properties, _unpackSize) {
27
+ return unbzip2Stream();
22
28
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/BZip2.ts"],"sourcesContent":["// BZip2 codec - bzip2 compression\n// 7z stores bzip2 data with the standard BZh header\n//\n// Uses seek-bzip for decompression (pure JavaScript)\n\nimport type { Transform } from 'readable-stream';\nimport Bunzip from 'seek-bzip';\nimport createBufferingDecoder from './createBufferingDecoder.ts';\n\n/**\n * Decode BZip2 compressed data\n *\n * @param input - BZip2 compressed data (with BZh header)\n * @param _properties - Unused for BZip2\n * @param _unpackSize - Unused for seek-bzip\n * @returns Decompressed data\n */\nexport function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer {\n // seek-bzip.decode(input, output) - returns output buffer\n return Bunzip.decode(input);\n}\n\n/**\n * Create a BZip2 decoder Transform stream\n */\nexport function createBzip2Decoder(properties?: Buffer, unpackSize?: number): Transform {\n return createBufferingDecoder(decodeBzip2, properties, unpackSize);\n}\n"],"names":["Bunzip","createBufferingDecoder","decodeBzip2","input","_properties","_unpackSize","decode","createBzip2Decoder","properties","unpackSize"],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AACpD,EAAE;AACF,qDAAqD;AAGrD,OAAOA,YAAY,YAAY;AAC/B,OAAOC,4BAA4B,8BAA8B;AAEjE;;;;;;;CAOC,GACD,OAAO,SAASC,YAAYC,KAAa,EAAEC,WAAoB,EAAEC,WAAoB;IACnF,0DAA0D;IAC1D,OAAOL,OAAOM,MAAM,CAACH;AACvB;AAEA;;CAEC,GACD,OAAO,SAASI,mBAAmBC,UAAmB,EAAEC,UAAmB;IACzE,OAAOR,uBAAuBC,aAAaM,YAAYC;AACzD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/7z-iterator/src/sevenz/codecs/BZip2.ts"],"sourcesContent":["// BZip2 codec - bzip2 compression\n// 7z stores bzip2 data with the standard BZh header\n//\n// Uses unbzip2-stream's internal bzip2 library for both sync and streaming decompression\n\nimport { bufferFrom } from 'extract-base-iterator';\nimport type { Transform } from 'readable-stream';\nimport unbzip2Stream from 'unbzip2-stream';\n\n// Access the internal bzip2 decoder from unbzip2-stream\nimport bzip2 from 'unbzip2-stream/lib/bzip2.js';\n\n/**\n * Decode BZip2 compressed data synchronously\n *\n * @param input - BZip2 compressed data (with BZh header)\n * @param _properties - Unused for BZip2\n * @param _unpackSize - Unused\n * @returns Decompressed data\n */\nexport function decodeBzip2(input: Buffer, _properties?: Buffer, _unpackSize?: number): Buffer {\n const chunks: number[] = [];\n bzip2.simple(bzip2.array(input), (byte: number) => {\n chunks.push(byte);\n });\n return bufferFrom(chunks);\n}\n\n/**\n * Create a BZip2 decoder Transform stream\n * Uses unbzip2-stream for true streaming decompression (block by block)\n */\nexport function createBzip2Decoder(_properties?: Buffer, _unpackSize?: number): Transform {\n return unbzip2Stream() as Transform;\n}\n"],"names":["bufferFrom","unbzip2Stream","bzip2","decodeBzip2","input","_properties","_unpackSize","chunks","simple","array","byte","push","createBzip2Decoder"],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AACpD,EAAE;AACF,yFAAyF;AAEzF,SAASA,UAAU,QAAQ,wBAAwB;AAEnD,OAAOC,mBAAmB,iBAAiB;AAE3C,wDAAwD;AACxD,OAAOC,WAAW,8BAA8B;AAEhD;;;;;;;CAOC,GACD,OAAO,SAASC,YAAYC,KAAa,EAAEC,WAAoB,EAAEC,WAAoB;IACnF,MAAMC,SAAmB,EAAE;IAC3BL,MAAMM,MAAM,CAACN,MAAMO,KAAK,CAACL,QAAQ,CAACM;QAChCH,OAAOI,IAAI,CAACD;IACd;IACA,OAAOV,WAAWO;AACpB;AAEA;;;CAGC,GACD,OAAO,SAASK,mBAAmBP,WAAoB,EAAEC,WAAoB;IAC3E,OAAOL;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "7z-iterator",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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,9 +56,9 @@
56
56
  "os-shim": "^0.1.3",
57
57
  "queue-cb": "^1.0.0",
58
58
  "readable-stream": "^2.0.2",
59
- "seek-bzip": "^2.0.0",
60
59
  "short-hash": "^1.0.0",
61
- "temp-suffix": "^1.0.10"
60
+ "temp-suffix": "^1.0.10",
61
+ "unbzip2-stream": "1.0.8"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/mocha": "*",