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.
- package/dist/cjs/sevenz/codecs/BZip2.d.cts +4 -3
- package/dist/cjs/sevenz/codecs/BZip2.d.ts +4 -3
- package/dist/cjs/sevenz/codecs/BZip2.js +11 -7
- package/dist/cjs/sevenz/codecs/BZip2.js.map +1 -1
- package/dist/esm/sevenz/codecs/BZip2.d.ts +4 -3
- package/dist/esm/sevenz/codecs/BZip2.js +15 -9
- package/dist/esm/sevenz/codecs/BZip2.js.map +1 -1
- package/package.json +3 -3
|
@@ -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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
24
|
-
var
|
|
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
|
-
|
|
32
|
-
|
|
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(
|
|
35
|
-
return (0,
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
|
14
|
+
* @param _unpackSize - Unused
|
|
13
15
|
* @returns Decompressed data
|
|
14
16
|
*/ export function decodeBzip2(input, _properties, _unpackSize) {
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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
|
|
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.
|
|
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": "*",
|