extract-base-iterator 2.2.6 → 2.3.1

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.
Files changed (36) hide show
  1. package/dist/cjs/index.d.cts +1 -0
  2. package/dist/cjs/index.d.ts +1 -0
  3. package/dist/cjs/index.js +1 -0
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/cjs/shared/EntryStream.d.cts +55 -0
  6. package/dist/cjs/shared/EntryStream.d.ts +55 -0
  7. package/dist/cjs/shared/EntryStream.js +197 -0
  8. package/dist/cjs/shared/EntryStream.js.map +1 -0
  9. package/dist/cjs/shared/compat.d.cts +78 -0
  10. package/dist/cjs/shared/compat.d.ts +78 -0
  11. package/dist/cjs/shared/compat.js +177 -0
  12. package/dist/cjs/shared/compat.js.map +1 -0
  13. package/dist/cjs/shared/crc32.d.cts +45 -0
  14. package/dist/cjs/shared/crc32.d.ts +45 -0
  15. package/dist/cjs/shared/crc32.js +76 -0
  16. package/dist/cjs/shared/crc32.js.map +1 -0
  17. package/dist/cjs/shared/index.d.cts +14 -0
  18. package/dist/cjs/shared/index.d.ts +14 -0
  19. package/dist/cjs/shared/index.js +76 -0
  20. package/dist/cjs/shared/index.js.map +1 -0
  21. package/dist/esm/index.d.ts +1 -0
  22. package/dist/esm/index.js +2 -0
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/shared/EntryStream.d.ts +55 -0
  25. package/dist/esm/shared/EntryStream.js +105 -0
  26. package/dist/esm/shared/EntryStream.js.map +1 -0
  27. package/dist/esm/shared/compat.d.ts +78 -0
  28. package/dist/esm/shared/compat.js +173 -0
  29. package/dist/esm/shared/compat.js.map +1 -0
  30. package/dist/esm/shared/crc32.d.ts +45 -0
  31. package/dist/esm/shared/crc32.js +75 -0
  32. package/dist/esm/shared/crc32.js.map +1 -0
  33. package/dist/esm/shared/index.d.ts +14 -0
  34. package/dist/esm/shared/index.js +13 -0
  35. package/dist/esm/shared/index.js.map +1 -0
  36. package/package.json +2 -1
@@ -7,5 +7,6 @@ export { default as DirectoryEntry } from './DirectoryEntry.js';
7
7
  export { default as FileEntry } from './FileEntry.js';
8
8
  export { default as LinkEntry } from './LinkEntry.js';
9
9
  export { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';
10
+ export * from './shared/index.js';
10
11
  export * from './types.js';
11
12
  export { default as waitForAccess } from './waitForAccess.js';
@@ -7,5 +7,6 @@ export { default as DirectoryEntry } from './DirectoryEntry.js';
7
7
  export { default as FileEntry } from './FileEntry.js';
8
8
  export { default as LinkEntry } from './LinkEntry.js';
9
9
  export { default as SymbolicLinkEntry } from './SymbolicLinkEntry.js';
10
+ export * from './shared/index.js';
10
11
  export * from './types.js';
11
12
  export { default as waitForAccess } from './waitForAccess.js';
package/dist/cjs/index.js CHANGED
@@ -34,6 +34,7 @@ var _DirectoryEntryts = /*#__PURE__*/ _interop_require_default(require("./Direct
34
34
  var _FileEntryts = /*#__PURE__*/ _interop_require_default(require("./FileEntry.js"));
35
35
  var _LinkEntryts = /*#__PURE__*/ _interop_require_default(require("./LinkEntry.js"));
36
36
  var _SymbolicLinkEntryts = /*#__PURE__*/ _interop_require_default(require("./SymbolicLinkEntry.js"));
37
+ _export_star(require("./shared/index.js"), exports);
37
38
  _export_star(require("./types.js"), exports);
38
39
  var _waitForAccessts = /*#__PURE__*/ _interop_require_default(require("./waitForAccess.js"));
39
40
  function _assert_this_initialized(self) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/index.ts"],"sourcesContent":["import './polyfills.ts';\nimport StackBaseIterator from 'stack-base-iterator';\n\nimport type { Entry } from './types.ts';\n\nexport default class ExtractBaseIterator extends StackBaseIterator<Entry> {}\n\nexport { default as DirectoryEntry } from './DirectoryEntry.ts';\nexport { default as FileEntry } from './FileEntry.ts';\nexport { default as LinkEntry } from './LinkEntry.ts';\nexport { default as SymbolicLinkEntry } from './SymbolicLinkEntry.ts';\nexport * from './types.ts';\nexport { default as waitForAccess } from './waitForAccess.ts';\n"],"names":["DirectoryEntry","FileEntry","LinkEntry","SymbolicLinkEntry","ExtractBaseIterator","waitForAccess","StackBaseIterator"],"mappings":";;;;;;;;;;;QAOoBA;eAAAA,yBAAc;;QACdC;eAAAA,oBAAS;;QACTC;eAAAA,oBAAS;;QACTC;eAAAA,4BAAiB;;;eALhBC;;QAODC;eAAAA,wBAAa;;;QAZ1B;wEACuB;uEAMY;kEACL;kEACA;0EACQ;qBAC/B;sEAC2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAP1B,IAAA,AAAMD,oCAAN;;cAAMA;aAAAA;gCAAAA;QAAN,OAAA,kBAAMA;;WAAAA;EAA4BE,0BAAiB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/index.ts"],"sourcesContent":["import './polyfills.ts';\nimport StackBaseIterator from 'stack-base-iterator';\n\nimport type { Entry } from './types.ts';\n\nexport default class ExtractBaseIterator extends StackBaseIterator<Entry> {}\n\nexport { default as DirectoryEntry } from './DirectoryEntry.ts';\nexport { default as FileEntry } from './FileEntry.ts';\nexport { default as LinkEntry } from './LinkEntry.ts';\nexport { default as SymbolicLinkEntry } from './SymbolicLinkEntry.ts';\n// Shared utilities for iterator libraries\nexport * from './shared/index.ts';\nexport * from './types.ts';\nexport { default as waitForAccess } from './waitForAccess.ts';\n"],"names":["DirectoryEntry","FileEntry","LinkEntry","SymbolicLinkEntry","ExtractBaseIterator","waitForAccess","StackBaseIterator"],"mappings":";;;;;;;;;;;QAOoBA;eAAAA,yBAAc;;QACdC;eAAAA,oBAAS;;QACTC;eAAAA,oBAAS;;QACTC;eAAAA,4BAAiB;;;eALhBC;;QASDC;eAAAA,wBAAa;;;QAd1B;wEACuB;uEAMY;kEACL;kEACA;0EACQ;qBAE/B;qBACA;sEAC2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAT1B,IAAA,AAAMD,oCAAN;;cAAMA;aAAAA;gCAAAA;QAAN,OAAA,kBAAMA;;WAAAA;EAA4BE,0BAAiB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * EntryStream - Simple readable-like stream for entry content
3
+ *
4
+ * Extends EventEmitter to emit 'data', 'end', 'error' events.
5
+ * Node 0.8 compatible.
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 { EventEmitter } from 'events';
14
+ /**
15
+ * Base stream class for archive entry content.
16
+ * Can be extended for special entry types like sparse files.
17
+ */
18
+ export default class EntryStream extends EventEmitter {
19
+ protected _paused: boolean;
20
+ protected _ended: boolean;
21
+ protected _endEmitted: boolean;
22
+ protected _buffered: Buffer[];
23
+ /**
24
+ * Push data to the stream
25
+ */
26
+ push(data: Buffer): void;
27
+ /**
28
+ * End the stream
29
+ */
30
+ end(): void;
31
+ /**
32
+ * Resume reading (drain buffered data)
33
+ */
34
+ resume(): this;
35
+ /**
36
+ * Pause reading
37
+ */
38
+ pause(): this;
39
+ /**
40
+ * Check if stream has ended
41
+ */
42
+ get ended(): boolean;
43
+ /**
44
+ * Pipe to a writable stream
45
+ */
46
+ pipe<T extends NodeJS.WritableStream>(dest: T): T;
47
+ /**
48
+ * Flush buffered data
49
+ */
50
+ protected _flush(): void;
51
+ /**
52
+ * Emit end event (only once)
53
+ */
54
+ protected _emitEnd(): void;
55
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * EntryStream - Simple readable-like stream for entry content
3
+ *
4
+ * Extends EventEmitter to emit 'data', 'end', 'error' events.
5
+ * Node 0.8 compatible.
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 { EventEmitter } from 'events';
14
+ /**
15
+ * Base stream class for archive entry content.
16
+ * Can be extended for special entry types like sparse files.
17
+ */
18
+ export default class EntryStream extends EventEmitter {
19
+ protected _paused: boolean;
20
+ protected _ended: boolean;
21
+ protected _endEmitted: boolean;
22
+ protected _buffered: Buffer[];
23
+ /**
24
+ * Push data to the stream
25
+ */
26
+ push(data: Buffer): void;
27
+ /**
28
+ * End the stream
29
+ */
30
+ end(): void;
31
+ /**
32
+ * Resume reading (drain buffered data)
33
+ */
34
+ resume(): this;
35
+ /**
36
+ * Pause reading
37
+ */
38
+ pause(): this;
39
+ /**
40
+ * Check if stream has ended
41
+ */
42
+ get ended(): boolean;
43
+ /**
44
+ * Pipe to a writable stream
45
+ */
46
+ pipe<T extends NodeJS.WritableStream>(dest: T): T;
47
+ /**
48
+ * Flush buffered data
49
+ */
50
+ protected _flush(): void;
51
+ /**
52
+ * Emit end event (only once)
53
+ */
54
+ protected _emitEnd(): void;
55
+ }
@@ -0,0 +1,197 @@
1
+ /**
2
+ * EntryStream - Simple readable-like stream for entry content
3
+ *
4
+ * Extends EventEmitter to emit 'data', 'end', 'error' events.
5
+ * Node 0.8 compatible.
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 _events = require("events");
23
+ function _assert_this_initialized(self) {
24
+ if (self === void 0) {
25
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
26
+ }
27
+ return self;
28
+ }
29
+ function _call_super(_this, derived, args) {
30
+ derived = _get_prototype_of(derived);
31
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
32
+ }
33
+ function _class_call_check(instance, Constructor) {
34
+ if (!(instance instanceof Constructor)) {
35
+ throw new TypeError("Cannot call a class as a function");
36
+ }
37
+ }
38
+ function _defineProperties(target, props) {
39
+ for(var i = 0; i < props.length; i++){
40
+ var descriptor = props[i];
41
+ descriptor.enumerable = descriptor.enumerable || false;
42
+ descriptor.configurable = true;
43
+ if ("value" in descriptor) descriptor.writable = true;
44
+ Object.defineProperty(target, descriptor.key, descriptor);
45
+ }
46
+ }
47
+ function _create_class(Constructor, protoProps, staticProps) {
48
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
49
+ if (staticProps) _defineProperties(Constructor, staticProps);
50
+ return Constructor;
51
+ }
52
+ function _get_prototype_of(o) {
53
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
54
+ return o.__proto__ || Object.getPrototypeOf(o);
55
+ };
56
+ return _get_prototype_of(o);
57
+ }
58
+ function _inherits(subClass, superClass) {
59
+ if (typeof superClass !== "function" && superClass !== null) {
60
+ throw new TypeError("Super expression must either be null or a function");
61
+ }
62
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
63
+ constructor: {
64
+ value: subClass,
65
+ writable: true,
66
+ configurable: true
67
+ }
68
+ });
69
+ if (superClass) _set_prototype_of(subClass, superClass);
70
+ }
71
+ function _possible_constructor_return(self, call) {
72
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
73
+ return call;
74
+ }
75
+ return _assert_this_initialized(self);
76
+ }
77
+ function _set_prototype_of(o, p) {
78
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
79
+ o.__proto__ = p;
80
+ return o;
81
+ };
82
+ return _set_prototype_of(o, p);
83
+ }
84
+ function _type_of(obj) {
85
+ "@swc/helpers - typeof";
86
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
87
+ }
88
+ function _is_native_reflect_construct() {
89
+ try {
90
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
91
+ } catch (_) {}
92
+ return (_is_native_reflect_construct = function() {
93
+ return !!result;
94
+ })();
95
+ }
96
+ var EntryStream = /*#__PURE__*/ function(EventEmitter) {
97
+ "use strict";
98
+ _inherits(EntryStream, EventEmitter);
99
+ function EntryStream() {
100
+ _class_call_check(this, EntryStream);
101
+ var _this;
102
+ _this = _call_super(this, EntryStream, arguments), _this._paused = true, _this._ended = false, _this._endEmitted = false, _this._buffered = [];
103
+ return _this;
104
+ }
105
+ var _proto = EntryStream.prototype;
106
+ /**
107
+ * Push data to the stream
108
+ */ _proto.push = function push(data) {
109
+ if (this._ended) return;
110
+ if (this._paused) {
111
+ this._buffered.push(data);
112
+ } else {
113
+ this.emit('data', data);
114
+ }
115
+ };
116
+ /**
117
+ * End the stream
118
+ */ _proto.end = function end() {
119
+ if (this._ended) return;
120
+ this._ended = true;
121
+ // If not paused, flush and emit end now
122
+ if (!this._paused) {
123
+ this._flush();
124
+ this._emitEnd();
125
+ }
126
+ // Otherwise, end will be emitted when resume() is called
127
+ };
128
+ /**
129
+ * Resume reading (drain buffered data)
130
+ */ _proto.resume = function resume() {
131
+ if (!this._paused) return this;
132
+ this._paused = false;
133
+ this._flush();
134
+ // If stream was ended while paused, emit end now
135
+ if (this._ended && !this._endEmitted) {
136
+ this._emitEnd();
137
+ }
138
+ return this;
139
+ };
140
+ /**
141
+ * Pause reading
142
+ */ _proto.pause = function pause() {
143
+ this._paused = true;
144
+ return this;
145
+ };
146
+ /**
147
+ * Pipe to a writable stream
148
+ */ _proto.pipe = function pipe(dest) {
149
+ var self = this;
150
+ // Cast to EventEmitter-compatible type for backpressure handling
151
+ var emitter = dest;
152
+ this.on('data', function onData(chunk) {
153
+ var canContinue = dest.write(chunk);
154
+ // Handle backpressure if dest returns false
155
+ if (canContinue === false && typeof emitter.once === 'function') {
156
+ self.pause();
157
+ emitter.once('drain', function onDrain() {
158
+ self.resume();
159
+ });
160
+ }
161
+ });
162
+ this.on('end', function onEnd() {
163
+ if (typeof dest.end === 'function') {
164
+ dest.end();
165
+ }
166
+ });
167
+ this.resume();
168
+ return dest;
169
+ };
170
+ /**
171
+ * Flush buffered data
172
+ */ _proto._flush = function _flush() {
173
+ while(this._buffered.length > 0){
174
+ var chunk = this._buffered.shift();
175
+ this.emit('data', chunk);
176
+ }
177
+ };
178
+ /**
179
+ * Emit end event (only once)
180
+ */ _proto._emitEnd = function _emitEnd() {
181
+ if (this._endEmitted) return;
182
+ this._endEmitted = true;
183
+ this.emit('end');
184
+ };
185
+ _create_class(EntryStream, [
186
+ {
187
+ key: "ended",
188
+ get: /**
189
+ * Check if stream has ended
190
+ */ function get() {
191
+ return this._ended;
192
+ }
193
+ }
194
+ ]);
195
+ return EntryStream;
196
+ }(_events.EventEmitter);
197
+ /* 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-like stream for entry content\n *\n * Extends EventEmitter to emit 'data', 'end', 'error' events.\n * Node 0.8 compatible.\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 { EventEmitter } from 'events';\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 EventEmitter {\n protected _paused = true;\n protected _ended = false;\n protected _endEmitted = false;\n protected _buffered: Buffer[] = [];\n\n /**\n * Push data to the stream\n */\n push(data: Buffer): void {\n if (this._ended) return;\n\n if (this._paused) {\n this._buffered.push(data);\n } else {\n this.emit('data', data);\n }\n }\n\n /**\n * End the stream\n */\n end(): void {\n if (this._ended) return;\n this._ended = true;\n\n // If not paused, flush and emit end now\n if (!this._paused) {\n this._flush();\n this._emitEnd();\n }\n // Otherwise, end will be emitted when resume() is called\n }\n\n /**\n * Resume reading (drain buffered data)\n */\n resume(): this {\n if (!this._paused) return this;\n this._paused = false;\n this._flush();\n // If stream was ended while paused, emit end now\n if (this._ended && !this._endEmitted) {\n this._emitEnd();\n }\n return this;\n }\n\n /**\n * Pause reading\n */\n pause(): this {\n this._paused = true;\n return this;\n }\n\n /**\n * Check if stream has ended\n */\n get ended(): boolean {\n return this._ended;\n }\n\n /**\n * Pipe to a writable stream\n */\n pipe<T extends NodeJS.WritableStream>(dest: T): T {\n var self = this;\n // Cast to EventEmitter-compatible type for backpressure handling\n var emitter = dest as T & { once?: (event: string, fn: () => void) => void };\n this.on('data', function onData(chunk: Buffer) {\n var canContinue = dest.write(chunk);\n // Handle backpressure if dest returns false\n if (canContinue === false && typeof emitter.once === 'function') {\n self.pause();\n emitter.once('drain', function onDrain() {\n self.resume();\n });\n }\n });\n\n this.on('end', function onEnd() {\n if (typeof dest.end === 'function') {\n dest.end();\n }\n });\n\n this.resume();\n return dest;\n }\n\n /**\n * Flush buffered data\n */\n protected _flush(): void {\n while (this._buffered.length > 0) {\n var chunk = this._buffered.shift();\n this.emit('data', chunk);\n }\n }\n\n /**\n * Emit end event (only once)\n */\n protected _emitEnd(): void {\n if (this._endEmitted) return;\n this._endEmitted = true;\n this.emit('end');\n }\n}\n"],"names":["EntryStream","_paused","_ended","_endEmitted","_buffered","push","data","emit","end","_flush","_emitEnd","resume","pause","pipe","dest","self","emitter","on","onData","chunk","canContinue","write","once","onDrain","onEnd","length","shift","ended","EventEmitter"],"mappings":"AAAA;;;;;;;;;;;CAWC;;;;;;;eAQoBA;;;sBANQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMd,IAAA,AAAMA,4BAAN;;cAAMA;aAAAA;gCAAAA;;gBAAN,kBAAMA,+BACTC,UAAU,YACVC,SAAS,aACTC,cAAc,aACdC,YAAsB,EAAE;;;iBAJfJ;IAMnB;;GAEC,GACDK,OAAAA,IAQC,GARDA,SAAAA,KAAKC,IAAY;QACf,IAAI,IAAI,CAACJ,MAAM,EAAE;QAEjB,IAAI,IAAI,CAACD,OAAO,EAAE;YAChB,IAAI,CAACG,SAAS,CAACC,IAAI,CAACC;QACtB,OAAO;YACL,IAAI,CAACC,IAAI,CAAC,QAAQD;QACpB;IACF;IAEA;;GAEC,GACDE,OAAAA,GAUC,GAVDA,SAAAA;QACE,IAAI,IAAI,CAACN,MAAM,EAAE;QACjB,IAAI,CAACA,MAAM,GAAG;QAEd,wCAAwC;QACxC,IAAI,CAAC,IAAI,CAACD,OAAO,EAAE;YACjB,IAAI,CAACQ,MAAM;YACX,IAAI,CAACC,QAAQ;QACf;IACA,yDAAyD;IAC3D;IAEA;;GAEC,GACDC,OAAAA,MASC,GATDA,SAAAA;QACE,IAAI,CAAC,IAAI,CAACV,OAAO,EAAE,OAAO,IAAI;QAC9B,IAAI,CAACA,OAAO,GAAG;QACf,IAAI,CAACQ,MAAM;QACX,iDAAiD;QACjD,IAAI,IAAI,CAACP,MAAM,IAAI,CAAC,IAAI,CAACC,WAAW,EAAE;YACpC,IAAI,CAACO,QAAQ;QACf;QACA,OAAO,IAAI;IACb;IAEA;;GAEC,GACDE,OAAAA,KAGC,GAHDA,SAAAA;QACE,IAAI,CAACX,OAAO,GAAG;QACf,OAAO,IAAI;IACb;IASA;;GAEC,GACDY,OAAAA,IAuBC,GAvBDA,SAAAA,KAAsCC,IAAO;QAC3C,IAAIC,OAAO,IAAI;QACf,iEAAiE;QACjE,IAAIC,UAAUF;QACd,IAAI,CAACG,EAAE,CAAC,QAAQ,SAASC,OAAOC,KAAa;YAC3C,IAAIC,cAAcN,KAAKO,KAAK,CAACF;YAC7B,4CAA4C;YAC5C,IAAIC,gBAAgB,SAAS,OAAOJ,QAAQM,IAAI,KAAK,YAAY;gBAC/DP,KAAKH,KAAK;gBACVI,QAAQM,IAAI,CAAC,SAAS,SAASC;oBAC7BR,KAAKJ,MAAM;gBACb;YACF;QACF;QAEA,IAAI,CAACM,EAAE,CAAC,OAAO,SAASO;YACtB,IAAI,OAAOV,KAAKN,GAAG,KAAK,YAAY;gBAClCM,KAAKN,GAAG;YACV;QACF;QAEA,IAAI,CAACG,MAAM;QACX,OAAOG;IACT;IAEA;;GAEC,GACD,OAAUL,MAKT,GALD,SAAUA;QACR,MAAO,IAAI,CAACL,SAAS,CAACqB,MAAM,GAAG,EAAG;YAChC,IAAIN,QAAQ,IAAI,CAACf,SAAS,CAACsB,KAAK;YAChC,IAAI,CAACnB,IAAI,CAAC,QAAQY;QACpB;IACF;IAEA;;GAEC,GACD,OAAUT,QAIT,GAJD,SAAUA;QACR,IAAI,IAAI,CAACP,WAAW,EAAE;QACtB,IAAI,CAACA,WAAW,GAAG;QACnB,IAAI,CAACI,IAAI,CAAC;IACZ;kBA5GmBP;;YA2Df2B,KAAAA;iBAAJ,AAHA;;GAEC,GACD;gBACE,OAAO,IAAI,CAACzB,MAAM;YACpB;;;WA7DmBF;EAAoB4B,oBAAY"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Buffer Compatibility Layer for Node.js 0.8+
3
+ *
4
+ * Provides buffer utilities that work across all Node.js versions
5
+ * WITHOUT modifying global Buffer object.
6
+ *
7
+ * Version history:
8
+ * - Node 0.8-4.4: Only has `new Buffer()`, no `Buffer.alloc/from`
9
+ * - Node 4.5+: Has `Buffer.alloc/from`, deprecates `new Buffer()`
10
+ * - Node 10+: Warns or errors on `new Buffer()`
11
+ *
12
+ * Solution: Feature detection with graceful fallback in both directions.
13
+ */
14
+ /**
15
+ * Allocate a zero-filled buffer (safe)
16
+ * - Uses Buffer.alloc() on Node 4.5+
17
+ * - Falls back to new Buffer() + fill on Node 0.8-4.4
18
+ */
19
+ export declare function allocBuffer(size: number): Buffer;
20
+ /**
21
+ * Allocate a buffer without initialization (unsafe but faster)
22
+ * - Uses Buffer.allocUnsafe() on Node 4.5+
23
+ * - Falls back to new Buffer() on Node 0.8-4.4
24
+ *
25
+ * WARNING: Buffer contents are uninitialized and may contain sensitive data.
26
+ * Only use when you will immediately overwrite all bytes.
27
+ */
28
+ export declare function allocBufferUnsafe(size: number): Buffer;
29
+ /**
30
+ * Create a buffer from string, array, or existing buffer
31
+ * - Uses Buffer.from() on Node 4.5+
32
+ * - Falls back to new Buffer() on Node 0.8-4.4
33
+ * - Handles Uint8Array conversion for Node 0.8 (crypto output compatibility)
34
+ */
35
+ export declare function bufferFrom(data: string | number[] | Buffer | Uint8Array, encoding?: BufferEncoding): Buffer;
36
+ /**
37
+ * Compare two buffers or buffer regions
38
+ * - Uses Buffer.compare() on Node 5.10+ (with offset support)
39
+ * - Falls back to manual comparison on Node 0.8-5.9
40
+ */
41
+ export declare function bufferCompare(source: Buffer, target: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
42
+ /**
43
+ * Check if buffer region equals byte array
44
+ * Useful for magic number detection without Buffer.from()
45
+ */
46
+ export declare function bufferEquals(buf: Buffer, offset: number, expected: number[]): boolean;
47
+ /**
48
+ * Copy buffer region to new buffer
49
+ * Works on all Node versions
50
+ */
51
+ export declare function bufferSliceCopy(buf: Buffer, start: number, end: number): Buffer;
52
+ /**
53
+ * Read 64-bit unsigned integer (little-endian)
54
+ * Uses two 32-bit reads since BigInt not available until Node 10.4
55
+ *
56
+ * WARNING: Only accurate for values < Number.MAX_SAFE_INTEGER (2^53 - 1)
57
+ * This covers files up to ~9 PB which is practical for all real use cases.
58
+ */
59
+ export declare function readUInt64LE(buf: Buffer, offset: number): number;
60
+ /**
61
+ * Write 64-bit unsigned integer (little-endian)
62
+ * Same precision limitation as readUInt64LE
63
+ */
64
+ export declare function writeUInt64LE(buf: Buffer, value: number, offset: number): void;
65
+ /**
66
+ * Concatenate buffers - compatible with Node 0.8
67
+ * Handles crypto output which may not be proper Buffer instances in old Node.
68
+ *
69
+ * NOTE: This function is primarily needed for AES decryption compatibility
70
+ * in Node 0.8 where crypto output may not be proper Buffer instances.
71
+ * Libraries not using crypto can use native Buffer.concat() directly.
72
+ */
73
+ export declare function bufferConcat(list: (Buffer | Uint8Array)[], totalLength?: number): Buffer;
74
+ /**
75
+ * Node 0.8 compatible isNaN (Number.isNaN didn't exist until ES2015)
76
+ * Uses self-comparison: NaN is the only value not equal to itself
77
+ */
78
+ export declare function isNaN(value: number): boolean;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Buffer Compatibility Layer for Node.js 0.8+
3
+ *
4
+ * Provides buffer utilities that work across all Node.js versions
5
+ * WITHOUT modifying global Buffer object.
6
+ *
7
+ * Version history:
8
+ * - Node 0.8-4.4: Only has `new Buffer()`, no `Buffer.alloc/from`
9
+ * - Node 4.5+: Has `Buffer.alloc/from`, deprecates `new Buffer()`
10
+ * - Node 10+: Warns or errors on `new Buffer()`
11
+ *
12
+ * Solution: Feature detection with graceful fallback in both directions.
13
+ */
14
+ /**
15
+ * Allocate a zero-filled buffer (safe)
16
+ * - Uses Buffer.alloc() on Node 4.5+
17
+ * - Falls back to new Buffer() + fill on Node 0.8-4.4
18
+ */
19
+ export declare function allocBuffer(size: number): Buffer;
20
+ /**
21
+ * Allocate a buffer without initialization (unsafe but faster)
22
+ * - Uses Buffer.allocUnsafe() on Node 4.5+
23
+ * - Falls back to new Buffer() on Node 0.8-4.4
24
+ *
25
+ * WARNING: Buffer contents are uninitialized and may contain sensitive data.
26
+ * Only use when you will immediately overwrite all bytes.
27
+ */
28
+ export declare function allocBufferUnsafe(size: number): Buffer;
29
+ /**
30
+ * Create a buffer from string, array, or existing buffer
31
+ * - Uses Buffer.from() on Node 4.5+
32
+ * - Falls back to new Buffer() on Node 0.8-4.4
33
+ * - Handles Uint8Array conversion for Node 0.8 (crypto output compatibility)
34
+ */
35
+ export declare function bufferFrom(data: string | number[] | Buffer | Uint8Array, encoding?: BufferEncoding): Buffer;
36
+ /**
37
+ * Compare two buffers or buffer regions
38
+ * - Uses Buffer.compare() on Node 5.10+ (with offset support)
39
+ * - Falls back to manual comparison on Node 0.8-5.9
40
+ */
41
+ export declare function bufferCompare(source: Buffer, target: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
42
+ /**
43
+ * Check if buffer region equals byte array
44
+ * Useful for magic number detection without Buffer.from()
45
+ */
46
+ export declare function bufferEquals(buf: Buffer, offset: number, expected: number[]): boolean;
47
+ /**
48
+ * Copy buffer region to new buffer
49
+ * Works on all Node versions
50
+ */
51
+ export declare function bufferSliceCopy(buf: Buffer, start: number, end: number): Buffer;
52
+ /**
53
+ * Read 64-bit unsigned integer (little-endian)
54
+ * Uses two 32-bit reads since BigInt not available until Node 10.4
55
+ *
56
+ * WARNING: Only accurate for values < Number.MAX_SAFE_INTEGER (2^53 - 1)
57
+ * This covers files up to ~9 PB which is practical for all real use cases.
58
+ */
59
+ export declare function readUInt64LE(buf: Buffer, offset: number): number;
60
+ /**
61
+ * Write 64-bit unsigned integer (little-endian)
62
+ * Same precision limitation as readUInt64LE
63
+ */
64
+ export declare function writeUInt64LE(buf: Buffer, value: number, offset: number): void;
65
+ /**
66
+ * Concatenate buffers - compatible with Node 0.8
67
+ * Handles crypto output which may not be proper Buffer instances in old Node.
68
+ *
69
+ * NOTE: This function is primarily needed for AES decryption compatibility
70
+ * in Node 0.8 where crypto output may not be proper Buffer instances.
71
+ * Libraries not using crypto can use native Buffer.concat() directly.
72
+ */
73
+ export declare function bufferConcat(list: (Buffer | Uint8Array)[], totalLength?: number): Buffer;
74
+ /**
75
+ * Node 0.8 compatible isNaN (Number.isNaN didn't exist until ES2015)
76
+ * Uses self-comparison: NaN is the only value not equal to itself
77
+ */
78
+ export declare function isNaN(value: number): boolean;