extract-base-iterator 2.3.0 → 2.3.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/shared/EntryStream.d.cts +35 -0
- package/dist/cjs/shared/EntryStream.d.ts +35 -0
- package/dist/cjs/shared/EntryStream.js +140 -0
- package/dist/cjs/shared/EntryStream.js.map +1 -0
- package/dist/cjs/shared/index.d.cts +1 -0
- package/dist/cjs/shared/index.d.ts +1 -0
- package/dist/cjs/shared/index.js +9 -0
- package/dist/cjs/shared/index.js.map +1 -1
- package/dist/esm/shared/EntryStream.d.ts +35 -0
- package/dist/esm/shared/EntryStream.js +43 -0
- package/dist/esm/shared/EntryStream.js.map +1 -0
- package/dist/esm/shared/index.d.ts +1 -0
- package/dist/esm/shared/index.js +1 -0
- package/dist/esm/shared/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EntryStream - Simple readable stream for entry content
|
|
3
|
+
*
|
|
4
|
+
* Extends Readable to emit 'data', 'end', 'error' events.
|
|
5
|
+
* Node 0.8 compatible via readable-stream polyfill.
|
|
6
|
+
*
|
|
7
|
+
* This base class is designed to be used by:
|
|
8
|
+
* - zip-iterator
|
|
9
|
+
* - 7z-iterator
|
|
10
|
+
* - tar-iterator
|
|
11
|
+
* - Any other archive iterator library
|
|
12
|
+
*/
|
|
13
|
+
import Stream from 'stream';
|
|
14
|
+
declare const ReadableBase: typeof Stream.Readable;
|
|
15
|
+
/**
|
|
16
|
+
* Base stream class for archive entry content.
|
|
17
|
+
* Can be extended for special entry types like sparse files.
|
|
18
|
+
*/
|
|
19
|
+
export default class EntryStream extends ReadableBase {
|
|
20
|
+
protected _ended: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Signal end of stream by pushing null
|
|
23
|
+
*/
|
|
24
|
+
end(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check if stream has ended
|
|
27
|
+
*/
|
|
28
|
+
get ended(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Required by Readable - called when consumer wants data.
|
|
31
|
+
* Data is pushed externally via push(), nothing to do here.
|
|
32
|
+
*/
|
|
33
|
+
_read(_size: number): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EntryStream - Simple readable stream for entry content
|
|
3
|
+
*
|
|
4
|
+
* Extends Readable to emit 'data', 'end', 'error' events.
|
|
5
|
+
* Node 0.8 compatible via readable-stream polyfill.
|
|
6
|
+
*
|
|
7
|
+
* This base class is designed to be used by:
|
|
8
|
+
* - zip-iterator
|
|
9
|
+
* - 7z-iterator
|
|
10
|
+
* - tar-iterator
|
|
11
|
+
* - Any other archive iterator library
|
|
12
|
+
*/
|
|
13
|
+
import Stream from 'stream';
|
|
14
|
+
declare const ReadableBase: typeof Stream.Readable;
|
|
15
|
+
/**
|
|
16
|
+
* Base stream class for archive entry content.
|
|
17
|
+
* Can be extended for special entry types like sparse files.
|
|
18
|
+
*/
|
|
19
|
+
export default class EntryStream extends ReadableBase {
|
|
20
|
+
protected _ended: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Signal end of stream by pushing null
|
|
23
|
+
*/
|
|
24
|
+
end(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check if stream has ended
|
|
27
|
+
*/
|
|
28
|
+
get ended(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Required by Readable - called when consumer wants data.
|
|
31
|
+
* Data is pushed externally via push(), nothing to do here.
|
|
32
|
+
*/
|
|
33
|
+
_read(_size: number): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EntryStream - Simple readable stream for entry content
|
|
3
|
+
*
|
|
4
|
+
* Extends Readable to emit 'data', 'end', 'error' events.
|
|
5
|
+
* Node 0.8 compatible via readable-stream polyfill.
|
|
6
|
+
*
|
|
7
|
+
* This base class is designed to be used by:
|
|
8
|
+
* - zip-iterator
|
|
9
|
+
* - 7z-iterator
|
|
10
|
+
* - tar-iterator
|
|
11
|
+
* - Any other archive iterator library
|
|
12
|
+
*/ "use strict";
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "default", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return EntryStream;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _readablestream = /*#__PURE__*/ _interop_require_default(require("readable-stream"));
|
|
23
|
+
var _stream = /*#__PURE__*/ _interop_require_default(require("stream"));
|
|
24
|
+
function _assert_this_initialized(self) {
|
|
25
|
+
if (self === void 0) {
|
|
26
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
27
|
+
}
|
|
28
|
+
return self;
|
|
29
|
+
}
|
|
30
|
+
function _call_super(_this, derived, args) {
|
|
31
|
+
derived = _get_prototype_of(derived);
|
|
32
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
33
|
+
}
|
|
34
|
+
function _class_call_check(instance, Constructor) {
|
|
35
|
+
if (!(instance instanceof Constructor)) {
|
|
36
|
+
throw new TypeError("Cannot call a class as a function");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function _defineProperties(target, props) {
|
|
40
|
+
for(var i = 0; i < props.length; i++){
|
|
41
|
+
var descriptor = props[i];
|
|
42
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
43
|
+
descriptor.configurable = true;
|
|
44
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
45
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
49
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
50
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
51
|
+
return Constructor;
|
|
52
|
+
}
|
|
53
|
+
function _get_prototype_of(o) {
|
|
54
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
55
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
56
|
+
};
|
|
57
|
+
return _get_prototype_of(o);
|
|
58
|
+
}
|
|
59
|
+
function _inherits(subClass, superClass) {
|
|
60
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
61
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
62
|
+
}
|
|
63
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
64
|
+
constructor: {
|
|
65
|
+
value: subClass,
|
|
66
|
+
writable: true,
|
|
67
|
+
configurable: true
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
71
|
+
}
|
|
72
|
+
function _interop_require_default(obj) {
|
|
73
|
+
return obj && obj.__esModule ? obj : {
|
|
74
|
+
default: obj
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function _possible_constructor_return(self, call) {
|
|
78
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
79
|
+
return call;
|
|
80
|
+
}
|
|
81
|
+
return _assert_this_initialized(self);
|
|
82
|
+
}
|
|
83
|
+
function _set_prototype_of(o, p) {
|
|
84
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
85
|
+
o.__proto__ = p;
|
|
86
|
+
return o;
|
|
87
|
+
};
|
|
88
|
+
return _set_prototype_of(o, p);
|
|
89
|
+
}
|
|
90
|
+
function _type_of(obj) {
|
|
91
|
+
"@swc/helpers - typeof";
|
|
92
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
93
|
+
}
|
|
94
|
+
function _is_native_reflect_construct() {
|
|
95
|
+
try {
|
|
96
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
97
|
+
} catch (_) {}
|
|
98
|
+
return (_is_native_reflect_construct = function() {
|
|
99
|
+
return !!result;
|
|
100
|
+
})();
|
|
101
|
+
}
|
|
102
|
+
// Use native streams when available, readable-stream only for Node 0.x
|
|
103
|
+
var major = +process.versions.node.split('.')[0];
|
|
104
|
+
var ReadableBase = major > 0 ? _stream.default.Readable : _readablestream.default.Readable;
|
|
105
|
+
var EntryStream = /*#__PURE__*/ function(ReadableBase) {
|
|
106
|
+
"use strict";
|
|
107
|
+
_inherits(EntryStream, ReadableBase);
|
|
108
|
+
function EntryStream() {
|
|
109
|
+
_class_call_check(this, EntryStream);
|
|
110
|
+
var _this;
|
|
111
|
+
_this = _call_super(this, EntryStream, arguments), _this._ended = false;
|
|
112
|
+
return _this;
|
|
113
|
+
}
|
|
114
|
+
var _proto = EntryStream.prototype;
|
|
115
|
+
/**
|
|
116
|
+
* Signal end of stream by pushing null
|
|
117
|
+
*/ _proto.end = function end() {
|
|
118
|
+
if (this._ended) return;
|
|
119
|
+
this._ended = true;
|
|
120
|
+
this.push(null);
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Required by Readable - called when consumer wants data.
|
|
124
|
+
* Data is pushed externally via push(), nothing to do here.
|
|
125
|
+
*/ _proto._read = function _read(_size) {
|
|
126
|
+
// Data is pushed externally, nothing to do here
|
|
127
|
+
};
|
|
128
|
+
_create_class(EntryStream, [
|
|
129
|
+
{
|
|
130
|
+
key: "ended",
|
|
131
|
+
get: /**
|
|
132
|
+
* Check if stream has ended
|
|
133
|
+
*/ function get() {
|
|
134
|
+
return this._ended;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]);
|
|
138
|
+
return EntryStream;
|
|
139
|
+
}(ReadableBase);
|
|
140
|
+
/* 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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/EntryStream.ts"],"sourcesContent":["/**\n * EntryStream - Simple readable stream for entry content\n *\n * Extends Readable to emit 'data', 'end', 'error' events.\n * Node 0.8 compatible via readable-stream polyfill.\n *\n * This base class is designed to be used by:\n * - zip-iterator\n * - 7z-iterator\n * - tar-iterator\n * - Any other archive iterator library\n */\n\nimport StreamCompat from 'readable-stream';\nimport Stream from 'stream';\n\n// Use native streams when available, readable-stream only for Node 0.x\nconst major = +process.versions.node.split('.')[0];\nconst ReadableBase: typeof Stream.Readable = major > 0 ? Stream.Readable : (StreamCompat.Readable as typeof Stream.Readable);\n\n/**\n * Base stream class for archive entry content.\n * Can be extended for special entry types like sparse files.\n */\nexport default class EntryStream extends ReadableBase {\n protected _ended = false;\n\n /**\n * Signal end of stream by pushing null\n */\n end(): void {\n if (this._ended) return;\n this._ended = true;\n this.push(null);\n }\n\n /**\n * Check if stream has ended\n */\n get ended(): boolean {\n return this._ended;\n }\n\n /**\n * Required by Readable - called when consumer wants data.\n * Data is pushed externally via push(), nothing to do here.\n */\n _read(_size: number): void {\n // Data is pushed externally, nothing to do here\n }\n}\n"],"names":["EntryStream","major","process","versions","node","split","ReadableBase","Stream","Readable","StreamCompat","_ended","end","push","_read","_size","ended"],"mappings":"AAAA;;;;;;;;;;;CAWC;;;;;;;eAaoBA;;;qEAXI;6DACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEnB,uEAAuE;AACvE,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,eAAuCL,QAAQ,IAAIM,eAAM,CAACC,QAAQ,GAAIC,uBAAY,CAACD,QAAQ;AAMlF,IAAA,AAAMR,4BAAN;;cAAMA;aAAAA;gCAAAA;;gBAAN,kBAAMA,+BACTU,SAAS;;;iBADAV;IAGnB;;GAEC,GACDW,OAAAA,GAIC,GAJDA,SAAAA;QACE,IAAI,IAAI,CAACD,MAAM,EAAE;QACjB,IAAI,CAACA,MAAM,GAAG;QACd,IAAI,CAACE,IAAI,CAAC;IACZ;IASA;;;GAGC,GACDC,OAAAA,KAEC,GAFDA,SAAAA,MAAMC,KAAa;IACjB,gDAAgD;IAClD;kBAzBmBd;;YAefe,KAAAA;iBAAJ,AAHA;;GAEC,GACD;gBACE,OAAO,IAAI,CAACL,MAAM;YACpB;;;WAjBmBV;EAAoBM"}
|
|
@@ -11,3 +11,4 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEquals, bufferFrom, bufferSliceCopy, isNaN, readUInt64LE, writeUInt64LE, } from './compat.js';
|
|
13
13
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
14
|
+
export { default as EntryStream } from './EntryStream.js';
|
|
@@ -11,3 +11,4 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEquals, bufferFrom, bufferSliceCopy, isNaN, readUInt64LE, writeUInt64LE, } from './compat.js';
|
|
13
13
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
14
|
+
export { default as EntryStream } from './EntryStream.js';
|
package/dist/cjs/shared/index.js
CHANGED
|
@@ -19,6 +19,9 @@ function _export(target, all) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
_export(exports, {
|
|
22
|
+
get EntryStream () {
|
|
23
|
+
return _EntryStreamts.default;
|
|
24
|
+
},
|
|
22
25
|
get allocBuffer () {
|
|
23
26
|
return _compatts.allocBuffer;
|
|
24
27
|
},
|
|
@@ -64,4 +67,10 @@ _export(exports, {
|
|
|
64
67
|
});
|
|
65
68
|
var _compatts = require("./compat.js");
|
|
66
69
|
var _crc32ts = require("./crc32.js");
|
|
70
|
+
var _EntryStreamts = /*#__PURE__*/ _interop_require_default(require("./EntryStream.js"));
|
|
71
|
+
function _interop_require_default(obj) {
|
|
72
|
+
return obj && obj.__esModule ? obj : {
|
|
73
|
+
default: obj
|
|
74
|
+
};
|
|
75
|
+
}
|
|
67
76
|
/* 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/extract-base-iterator/src/shared/index.ts"],"sourcesContent":["/**\n * Shared utilities for iterator libraries\n *\n * These utilities are designed to be used by:\n * - zip-iterator\n * - 7z-iterator\n * - tar-iterator\n * - Any other archive iterator library\n *\n * All utilities support Node.js 0.8+\n */\n\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n isNaN,\n readUInt64LE,\n writeUInt64LE,\n} from './compat.ts';\n\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\n"],"names":["allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","crc32","crc32Region","isNaN","readUInt64LE","verifyCrc32","verifyCrc32Region","writeUInt64LE"],"mappings":"AAAA;;;;;;;;;;CAUC;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/index.ts"],"sourcesContent":["/**\n * Shared utilities for iterator libraries\n *\n * These utilities are designed to be used by:\n * - zip-iterator\n * - 7z-iterator\n * - tar-iterator\n * - Any other archive iterator library\n *\n * All utilities support Node.js 0.8+\n */\n\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n isNaN,\n readUInt64LE,\n writeUInt64LE,\n} from './compat.ts';\n\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\n\nexport { default as EntryStream } from './EntryStream.ts';\n"],"names":["EntryStream","allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","crc32","crc32Region","isNaN","readUInt64LE","verifyCrc32","verifyCrc32Region","writeUInt64LE"],"mappings":"AAAA;;;;;;;;;;CAUC;;;;;;;;;;;QAiBmBA;eAAAA,sBAAW;;QAd7BC;eAAAA,qBAAW;;QACXC;eAAAA,2BAAiB;;QACjBC;eAAAA,uBAAa;;QACbC;eAAAA,sBAAY;;QACZC;eAAAA,sBAAY;;QACZC;eAAAA,oBAAU;;QACVC;eAAAA,yBAAe;;QAMRC;eAAAA,cAAK;;QAAEC;eAAAA,oBAAW;;QALzBC;eAAAA,eAAK;;QACLC;eAAAA,sBAAY;;QAIeC;eAAAA,oBAAW;;QAAEC;eAAAA,0BAAiB;;QAHzDC;eAAAA,uBAAa;;;wBACR;uBAE4D;oEAE5B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EntryStream - Simple readable stream for entry content
|
|
3
|
+
*
|
|
4
|
+
* Extends Readable to emit 'data', 'end', 'error' events.
|
|
5
|
+
* Node 0.8 compatible via readable-stream polyfill.
|
|
6
|
+
*
|
|
7
|
+
* This base class is designed to be used by:
|
|
8
|
+
* - zip-iterator
|
|
9
|
+
* - 7z-iterator
|
|
10
|
+
* - tar-iterator
|
|
11
|
+
* - Any other archive iterator library
|
|
12
|
+
*/
|
|
13
|
+
import Stream from 'stream';
|
|
14
|
+
declare const ReadableBase: typeof Stream.Readable;
|
|
15
|
+
/**
|
|
16
|
+
* Base stream class for archive entry content.
|
|
17
|
+
* Can be extended for special entry types like sparse files.
|
|
18
|
+
*/
|
|
19
|
+
export default class EntryStream extends ReadableBase {
|
|
20
|
+
protected _ended: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Signal end of stream by pushing null
|
|
23
|
+
*/
|
|
24
|
+
end(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check if stream has ended
|
|
27
|
+
*/
|
|
28
|
+
get ended(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Required by Readable - called when consumer wants data.
|
|
31
|
+
* Data is pushed externally via push(), nothing to do here.
|
|
32
|
+
*/
|
|
33
|
+
_read(_size: number): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EntryStream - Simple readable stream for entry content
|
|
3
|
+
*
|
|
4
|
+
* Extends Readable to emit 'data', 'end', 'error' events.
|
|
5
|
+
* Node 0.8 compatible via readable-stream polyfill.
|
|
6
|
+
*
|
|
7
|
+
* This base class is designed to be used by:
|
|
8
|
+
* - zip-iterator
|
|
9
|
+
* - 7z-iterator
|
|
10
|
+
* - tar-iterator
|
|
11
|
+
* - Any other archive iterator library
|
|
12
|
+
*/ import StreamCompat from 'readable-stream';
|
|
13
|
+
import Stream from 'stream';
|
|
14
|
+
// Use native streams when available, readable-stream only for Node 0.x
|
|
15
|
+
const major = +process.versions.node.split('.')[0];
|
|
16
|
+
const ReadableBase = major > 0 ? Stream.Readable : StreamCompat.Readable;
|
|
17
|
+
let EntryStream = class EntryStream extends ReadableBase {
|
|
18
|
+
/**
|
|
19
|
+
* Signal end of stream by pushing null
|
|
20
|
+
*/ end() {
|
|
21
|
+
if (this._ended) return;
|
|
22
|
+
this._ended = true;
|
|
23
|
+
this.push(null);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if stream has ended
|
|
27
|
+
*/ get ended() {
|
|
28
|
+
return this._ended;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Required by Readable - called when consumer wants data.
|
|
32
|
+
* Data is pushed externally via push(), nothing to do here.
|
|
33
|
+
*/ _read(_size) {
|
|
34
|
+
// Data is pushed externally, nothing to do here
|
|
35
|
+
}
|
|
36
|
+
constructor(...args){
|
|
37
|
+
super(...args), this._ended = false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Base stream class for archive entry content.
|
|
42
|
+
* Can be extended for special entry types like sparse files.
|
|
43
|
+
*/ export { EntryStream as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/EntryStream.ts"],"sourcesContent":["/**\n * EntryStream - Simple readable stream for entry content\n *\n * Extends Readable to emit 'data', 'end', 'error' events.\n * Node 0.8 compatible via readable-stream polyfill.\n *\n * This base class is designed to be used by:\n * - zip-iterator\n * - 7z-iterator\n * - tar-iterator\n * - Any other archive iterator library\n */\n\nimport StreamCompat from 'readable-stream';\nimport Stream from 'stream';\n\n// Use native streams when available, readable-stream only for Node 0.x\nconst major = +process.versions.node.split('.')[0];\nconst ReadableBase: typeof Stream.Readable = major > 0 ? Stream.Readable : (StreamCompat.Readable as typeof Stream.Readable);\n\n/**\n * Base stream class for archive entry content.\n * Can be extended for special entry types like sparse files.\n */\nexport default class EntryStream extends ReadableBase {\n protected _ended = false;\n\n /**\n * Signal end of stream by pushing null\n */\n end(): void {\n if (this._ended) return;\n this._ended = true;\n this.push(null);\n }\n\n /**\n * Check if stream has ended\n */\n get ended(): boolean {\n return this._ended;\n }\n\n /**\n * Required by Readable - called when consumer wants data.\n * Data is pushed externally via push(), nothing to do here.\n */\n _read(_size: number): void {\n // Data is pushed externally, nothing to do here\n }\n}\n"],"names":["StreamCompat","Stream","major","process","versions","node","split","ReadableBase","Readable","EntryStream","end","_ended","push","ended","_read","_size"],"mappings":"AAAA;;;;;;;;;;;CAWC,GAED,OAAOA,kBAAkB,kBAAkB;AAC3C,OAAOC,YAAY,SAAS;AAE5B,uEAAuE;AACvE,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,eAAuCL,QAAQ,IAAID,OAAOO,QAAQ,GAAIR,aAAaQ,QAAQ;AAMlF,IAAA,AAAMC,cAAN,MAAMA,oBAAoBF;IAGvC;;GAEC,GACDG,MAAY;QACV,IAAI,IAAI,CAACC,MAAM,EAAE;QACjB,IAAI,CAACA,MAAM,GAAG;QACd,IAAI,CAACC,IAAI,CAAC;IACZ;IAEA;;GAEC,GACD,IAAIC,QAAiB;QACnB,OAAO,IAAI,CAACF,MAAM;IACpB;IAEA;;;GAGC,GACDG,MAAMC,KAAa,EAAQ;IACzB,gDAAgD;IAClD;;QAzBa,qBACHJ,SAAS;;AAyBrB;AA9BA;;;CAGC,GACD,SAAqBF,yBA0BpB"}
|
|
@@ -11,3 +11,4 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEquals, bufferFrom, bufferSliceCopy, isNaN, readUInt64LE, writeUInt64LE, } from './compat.js';
|
|
13
13
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
14
|
+
export { default as EntryStream } from './EntryStream.js';
|
package/dist/esm/shared/index.js
CHANGED
|
@@ -10,3 +10,4 @@
|
|
|
10
10
|
* All utilities support Node.js 0.8+
|
|
11
11
|
*/ export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEquals, bufferFrom, bufferSliceCopy, isNaN, readUInt64LE, writeUInt64LE } from './compat.js';
|
|
12
12
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
13
|
+
export { default as EntryStream } from './EntryStream.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/index.ts"],"sourcesContent":["/**\n * Shared utilities for iterator libraries\n *\n * These utilities are designed to be used by:\n * - zip-iterator\n * - 7z-iterator\n * - tar-iterator\n * - Any other archive iterator library\n *\n * All utilities support Node.js 0.8+\n */\n\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n isNaN,\n readUInt64LE,\n writeUInt64LE,\n} from './compat.ts';\n\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\n"],"names":["allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","isNaN","readUInt64LE","writeUInt64LE","crc32","crc32Region","verifyCrc32","verifyCrc32Region"],"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SACEA,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,eAAe,EACfC,KAAK,EACLC,YAAY,EACZC,aAAa,QACR,cAAc;AAErB,SAASC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,iBAAiB,QAAQ,aAAa"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/index.ts"],"sourcesContent":["/**\n * Shared utilities for iterator libraries\n *\n * These utilities are designed to be used by:\n * - zip-iterator\n * - 7z-iterator\n * - tar-iterator\n * - Any other archive iterator library\n *\n * All utilities support Node.js 0.8+\n */\n\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n isNaN,\n readUInt64LE,\n writeUInt64LE,\n} from './compat.ts';\n\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\n\nexport { default as EntryStream } from './EntryStream.ts';\n"],"names":["allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","isNaN","readUInt64LE","writeUInt64LE","crc32","crc32Region","verifyCrc32","verifyCrc32Region","default","EntryStream"],"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SACEA,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,eAAe,EACfC,KAAK,EACLC,YAAY,EACZC,aAAa,QACR,cAAc;AAErB,SAASC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,iBAAiB,QAAQ,aAAa;AAEhF,SAASC,WAAWC,WAAW,QAAQ,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extract-base-iterator",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Base iterator for extract iterators like tar-iterator and zip-iterator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extract",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"next-tick": "*",
|
|
50
50
|
"object-assign": "*",
|
|
51
51
|
"queue-cb": "*",
|
|
52
|
+
"readable-stream": "^2.3.8",
|
|
52
53
|
"rimraf2": "*",
|
|
53
54
|
"stack-base-iterator": "*"
|
|
54
55
|
},
|