extract-base-iterator 2.6.0 → 2.6.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.
- package/dist/cjs/shared/index.d.cts +2 -0
- package/dist/cjs/shared/index.d.ts +2 -0
- package/dist/cjs/shared/index.js +8 -0
- package/dist/cjs/shared/index.js.map +1 -1
- package/dist/cjs/shared/normalizePath.d.cts +10 -0
- package/dist/cjs/shared/normalizePath.d.ts +10 -0
- package/dist/cjs/shared/normalizePath.js +30 -0
- package/dist/cjs/shared/normalizePath.js.map +1 -0
- package/dist/cjs/shared/streamToString.d.cts +10 -0
- package/dist/cjs/shared/streamToString.d.ts +10 -0
- package/dist/cjs/shared/streamToString.js +53 -0
- package/dist/cjs/shared/streamToString.js.map +1 -0
- package/dist/esm/shared/index.d.ts +2 -0
- package/dist/esm/shared/index.js +2 -0
- package/dist/esm/shared/index.js.map +1 -1
- package/dist/esm/shared/normalizePath.d.ts +10 -0
- package/dist/esm/shared/normalizePath.js +19 -0
- package/dist/esm/shared/normalizePath.js.map +1 -0
- package/dist/esm/shared/streamToString.d.ts +10 -0
- package/dist/esm/shared/streamToString.js +37 -0
- package/dist/esm/shared/streamToString.js.map +1 -0
- package/package.json +3 -2
|
@@ -14,3 +14,5 @@ export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEqua
|
|
|
14
14
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
15
15
|
export { default as EntryStream } from './EntryStream.js';
|
|
16
16
|
export { type CleanupFn, default as Lock } from './Lock.js';
|
|
17
|
+
export { default as normalizePath } from './normalizePath.js';
|
|
18
|
+
export { default as streamToString, type StreamToStringCallback } from './streamToString.js';
|
|
@@ -14,3 +14,5 @@ export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEqua
|
|
|
14
14
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
15
15
|
export { default as EntryStream } from './EntryStream.js';
|
|
16
16
|
export { type CleanupFn, default as Lock } from './Lock.js';
|
|
17
|
+
export { default as normalizePath } from './normalizePath.js';
|
|
18
|
+
export { default as streamToString, type StreamToStringCallback } from './streamToString.js';
|
package/dist/cjs/shared/index.js
CHANGED
|
@@ -64,6 +64,9 @@ _export(exports, {
|
|
|
64
64
|
get isNaN () {
|
|
65
65
|
return _compatts.isNaN;
|
|
66
66
|
},
|
|
67
|
+
get normalizePath () {
|
|
68
|
+
return _normalizePathts.default;
|
|
69
|
+
},
|
|
67
70
|
get objectAssign () {
|
|
68
71
|
return _compatts.objectAssign;
|
|
69
72
|
},
|
|
@@ -73,6 +76,9 @@ _export(exports, {
|
|
|
73
76
|
get setImmediateFn () {
|
|
74
77
|
return _compatts.setImmediateFn;
|
|
75
78
|
},
|
|
79
|
+
get streamToString () {
|
|
80
|
+
return _streamToStringts.default;
|
|
81
|
+
},
|
|
76
82
|
get verifyCrc32 () {
|
|
77
83
|
return _crc32ts.verifyCrc32;
|
|
78
84
|
},
|
|
@@ -88,6 +94,8 @@ var _compatts = require("./compat.js");
|
|
|
88
94
|
var _crc32ts = require("./crc32.js");
|
|
89
95
|
var _EntryStreamts = /*#__PURE__*/ _interop_require_default(require("./EntryStream.js"));
|
|
90
96
|
var _Lockts = /*#__PURE__*/ _interop_require_default(require("./Lock.js"));
|
|
97
|
+
var _normalizePathts = /*#__PURE__*/ _interop_require_default(require("./normalizePath.js"));
|
|
98
|
+
var _streamToStringts = /*#__PURE__*/ _interop_require_default(require("./streamToString.js"));
|
|
91
99
|
function _interop_require_default(obj) {
|
|
92
100
|
return obj && obj.__esModule ? obj : {
|
|
93
101
|
default: obj
|
|
@@ -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 { default as BufferList } from './BufferList.ts';\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n createInflateRawStream,\n inflateRaw,\n isNaN,\n objectAssign,\n readUInt64LE,\n setImmediateFn,\n writeUInt64LE,\n} from './compat.ts';\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\nexport { default as EntryStream } from './EntryStream.ts';\nexport { type CleanupFn, default as Lock } from './Lock.ts';\n"],"names":["BufferList","EntryStream","Lock","allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","crc32","crc32Region","createInflateRawStream","inflateRaw","isNaN","objectAssign","readUInt64LE","setImmediateFn","verifyCrc32","verifyCrc32Region","writeUInt64LE"],"mappings":"AAAA;;;;;;;;;;CAUC;;;;;;;;;;;QAEmBA;eAAAA,qBAAU;;QAkBVC;eAAAA,sBAAW;;QACKC;eAAAA,eAAI;;QAjBtCC;eAAAA,qBAAW;;QACXC;eAAAA,2BAAiB;;QACjBC;eAAAA,uBAAa;;QACbC;eAAAA,sBAAY;;QACZC;eAAAA,sBAAY;;QACZC;eAAAA,oBAAU;;QACVC;eAAAA,yBAAe;;QASRC;eAAAA,cAAK;;QAAEC;eAAAA,oBAAW;;QARzBC;eAAAA,gCAAsB;;QACtBC;eAAAA,oBAAU;;QACVC;eAAAA,eAAK;;
|
|
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 { default as BufferList } from './BufferList.ts';\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n createInflateRawStream,\n inflateRaw,\n isNaN,\n objectAssign,\n readUInt64LE,\n setImmediateFn,\n writeUInt64LE,\n} from './compat.ts';\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\nexport { default as EntryStream } from './EntryStream.ts';\nexport { type CleanupFn, default as Lock } from './Lock.ts';\nexport { default as normalizePath } from './normalizePath.ts';\nexport { default as streamToString, type StreamToStringCallback } from './streamToString.ts';\n"],"names":["BufferList","EntryStream","Lock","allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","crc32","crc32Region","createInflateRawStream","inflateRaw","isNaN","normalizePath","objectAssign","readUInt64LE","setImmediateFn","streamToString","verifyCrc32","verifyCrc32Region","writeUInt64LE"],"mappings":"AAAA;;;;;;;;;;CAUC;;;;;;;;;;;QAEmBA;eAAAA,qBAAU;;QAkBVC;eAAAA,sBAAW;;QACKC;eAAAA,eAAI;;QAjBtCC;eAAAA,qBAAW;;QACXC;eAAAA,2BAAiB;;QACjBC;eAAAA,uBAAa;;QACbC;eAAAA,sBAAY;;QACZC;eAAAA,sBAAY;;QACZC;eAAAA,oBAAU;;QACVC;eAAAA,yBAAe;;QASRC;eAAAA,cAAK;;QAAEC;eAAAA,oBAAW;;QARzBC;eAAAA,gCAAsB;;QACtBC;eAAAA,oBAAU;;QACVC;eAAAA,eAAK;;QASaC;eAAAA,wBAAa;;QAR/BC;eAAAA,sBAAY;;QACZC;eAAAA,sBAAY;;QACZC;eAAAA,wBAAc;;QAOIC;eAAAA,yBAAc;;QAJLC;eAAAA,oBAAW;;QAAEC;eAAAA,0BAAiB;;QAFzDC;eAAAA,uBAAa;;;mEAfuB;wBAgB/B;uBAC4D;oEAC5B;6DACS;sEACP;uEAC8B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize archive entry path
|
|
3
|
+
*
|
|
4
|
+
* - Converts backslashes to forward slashes
|
|
5
|
+
* - Removes empty segments
|
|
6
|
+
* - Removes leading slashes
|
|
7
|
+
*
|
|
8
|
+
* Node 0.8+ compatible.
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "default", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return normalizePath;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function normalizePath(p) {
|
|
20
|
+
// Split on both forward and back slashes, filter empty segments, rejoin with forward slash
|
|
21
|
+
var segments = p.split(/[/\\]/);
|
|
22
|
+
var result = [];
|
|
23
|
+
for(var i = 0; i < segments.length; i++){
|
|
24
|
+
if (segments[i].length > 0) {
|
|
25
|
+
result.push(segments[i]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result.join('/');
|
|
29
|
+
}
|
|
30
|
+
/* 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/normalizePath.ts"],"sourcesContent":["/**\n * Normalize archive entry path\n *\n * - Converts backslashes to forward slashes\n * - Removes empty segments\n * - Removes leading slashes\n *\n * Node 0.8+ compatible.\n */\n\nexport default function normalizePath(p: string): string {\n // Split on both forward and back slashes, filter empty segments, rejoin with forward slash\n const segments = p.split(/[/\\\\]/);\n const result: string[] = [];\n for (let i = 0; i < segments.length; i++) {\n if (segments[i].length > 0) {\n result.push(segments[i]);\n }\n }\n return result.join('/');\n}\n"],"names":["normalizePath","p","segments","split","result","i","length","push","join"],"mappings":"AAAA;;;;;;;;CAQC;;;;+BAED;;;eAAwBA;;;AAAT,SAASA,cAAcC,CAAS;IAC7C,2FAA2F;IAC3F,IAAMC,WAAWD,EAAEE,KAAK,CAAC;IACzB,IAAMC,SAAmB,EAAE;IAC3B,IAAK,IAAIC,IAAI,GAAGA,IAAIH,SAASI,MAAM,EAAED,IAAK;QACxC,IAAIH,QAAQ,CAACG,EAAE,CAACC,MAAM,GAAG,GAAG;YAC1BF,OAAOG,IAAI,CAACL,QAAQ,CAACG,EAAE;QACzB;IACF;IACA,OAAOD,OAAOI,IAAI,CAAC;AACrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read entire stream content as string
|
|
3
|
+
*
|
|
4
|
+
* Handles both flowing streams and streams that have already
|
|
5
|
+
* buffered data (using readable stream semantics).
|
|
6
|
+
*
|
|
7
|
+
* Node 0.8+ compatible.
|
|
8
|
+
*/
|
|
9
|
+
export type StreamToStringCallback = (error?: Error, result?: string) => undefined;
|
|
10
|
+
export default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read entire stream content as string
|
|
3
|
+
*
|
|
4
|
+
* Handles both flowing streams and streams that have already
|
|
5
|
+
* buffered data (using readable stream semantics).
|
|
6
|
+
*
|
|
7
|
+
* Node 0.8+ compatible.
|
|
8
|
+
*/
|
|
9
|
+
export type StreamToStringCallback = (error?: Error, result?: string) => undefined;
|
|
10
|
+
export default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read entire stream content as string
|
|
3
|
+
*
|
|
4
|
+
* Handles both flowing streams and streams that have already
|
|
5
|
+
* buffered data (using readable stream semantics).
|
|
6
|
+
*
|
|
7
|
+
* Node 0.8+ compatible.
|
|
8
|
+
*/ "use strict";
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return streamToString;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _onone = /*#__PURE__*/ _interop_require_default(require("on-one"));
|
|
19
|
+
var _compatts = require("./compat.js");
|
|
20
|
+
function _interop_require_default(obj) {
|
|
21
|
+
return obj && obj.__esModule ? obj : {
|
|
22
|
+
default: obj
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function streamToString(stream, callback) {
|
|
26
|
+
var chunks = [];
|
|
27
|
+
// Handle data from the stream
|
|
28
|
+
stream.on('data', function(chunk) {
|
|
29
|
+
if (typeof chunk === 'string') {
|
|
30
|
+
chunks.push((0, _compatts.bufferFrom)(chunk, 'utf8'));
|
|
31
|
+
} else {
|
|
32
|
+
chunks.push(chunk);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// Handle stream end events using on-one for Node 0.8 compatibility
|
|
36
|
+
(0, _onone.default)(stream, [
|
|
37
|
+
'error',
|
|
38
|
+
'end',
|
|
39
|
+
'close'
|
|
40
|
+
], function(err) {
|
|
41
|
+
if (err) {
|
|
42
|
+
callback(err);
|
|
43
|
+
} else {
|
|
44
|
+
var content = Buffer.concat(chunks).toString('utf8');
|
|
45
|
+
callback(null, content);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
// Ensure stream is flowing (in case it's paused)
|
|
49
|
+
if (typeof stream.resume === 'function') {
|
|
50
|
+
stream.resume();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/* 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/streamToString.ts"],"sourcesContent":["/**\n * Read entire stream content as string\n *\n * Handles both flowing streams and streams that have already\n * buffered data (using readable stream semantics).\n *\n * Node 0.8+ compatible.\n */\n\nimport oo from 'on-one';\nimport { bufferFrom } from './compat.ts';\n\nexport type StreamToStringCallback = (error?: Error, result?: string) => undefined;\n\nexport default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void {\n const chunks: Buffer[] = [];\n\n // Handle data from the stream\n stream.on('data', (chunk: Buffer | string) => {\n if (typeof chunk === 'string') {\n chunks.push(bufferFrom(chunk, 'utf8'));\n } else {\n chunks.push(chunk);\n }\n });\n\n // Handle stream end events using on-one for Node 0.8 compatibility\n oo(stream, ['error', 'end', 'close'], (err?: Error) => {\n if (err) {\n callback(err);\n } else {\n const content = Buffer.concat(chunks).toString('utf8');\n callback(null, content);\n }\n });\n\n // Ensure stream is flowing (in case it's paused)\n if (typeof (stream as NodeJS.ReadStream).resume === 'function') {\n (stream as NodeJS.ReadStream).resume();\n }\n}\n"],"names":["streamToString","stream","callback","chunks","on","chunk","push","bufferFrom","oo","err","content","Buffer","concat","toString","resume"],"mappings":"AAAA;;;;;;;CAOC;;;;+BAOD;;;eAAwBA;;;4DALT;wBACY;;;;;;AAIZ,SAASA,eAAeC,MAA6B,EAAEC,QAAgC;IACpG,IAAMC,SAAmB,EAAE;IAE3B,8BAA8B;IAC9BF,OAAOG,EAAE,CAAC,QAAQ,SAACC;QACjB,IAAI,OAAOA,UAAU,UAAU;YAC7BF,OAAOG,IAAI,CAACC,IAAAA,oBAAU,EAACF,OAAO;QAChC,OAAO;YACLF,OAAOG,IAAI,CAACD;QACd;IACF;IAEA,mEAAmE;IACnEG,IAAAA,cAAE,EAACP,QAAQ;QAAC;QAAS;QAAO;KAAQ,EAAE,SAACQ;QACrC,IAAIA,KAAK;YACPP,SAASO;QACX,OAAO;YACL,IAAMC,UAAUC,OAAOC,MAAM,CAACT,QAAQU,QAAQ,CAAC;YAC/CX,SAAS,MAAMQ;QACjB;IACF;IAEA,iDAAiD;IACjD,IAAI,OAAO,AAACT,OAA6Ba,MAAM,KAAK,YAAY;QAC7Db,OAA6Ba,MAAM;IACtC;AACF"}
|
|
@@ -14,3 +14,5 @@ export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEqua
|
|
|
14
14
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
15
15
|
export { default as EntryStream } from './EntryStream.js';
|
|
16
16
|
export { type CleanupFn, default as Lock } from './Lock.js';
|
|
17
|
+
export { default as normalizePath } from './normalizePath.js';
|
|
18
|
+
export { default as streamToString, type StreamToStringCallback } from './streamToString.js';
|
package/dist/esm/shared/index.js
CHANGED
|
@@ -13,3 +13,5 @@ export { allocBuffer, allocBufferUnsafe, bufferCompare, bufferConcat, bufferEqua
|
|
|
13
13
|
export { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.js';
|
|
14
14
|
export { default as EntryStream } from './EntryStream.js';
|
|
15
15
|
export { default as Lock } from './Lock.js';
|
|
16
|
+
export { default as normalizePath } from './normalizePath.js';
|
|
17
|
+
export { default as streamToString } from './streamToString.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 { default as BufferList } from './BufferList.ts';\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n createInflateRawStream,\n inflateRaw,\n isNaN,\n objectAssign,\n readUInt64LE,\n setImmediateFn,\n writeUInt64LE,\n} from './compat.ts';\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\nexport { default as EntryStream } from './EntryStream.ts';\nexport { type CleanupFn, default as Lock } from './Lock.ts';\n"],"names":["default","BufferList","allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","createInflateRawStream","inflateRaw","isNaN","objectAssign","readUInt64LE","setImmediateFn","writeUInt64LE","crc32","crc32Region","verifyCrc32","verifyCrc32Region","EntryStream","Lock"],"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SAASA,WAAWC,UAAU,QAAQ,kBAAkB;AACxD,SACEC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,eAAe,EACfC,sBAAsB,EACtBC,UAAU,EACVC,KAAK,EACLC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,aAAa,QACR,cAAc;AACrB,SAASC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,iBAAiB,QAAQ,aAAa;AAChF,SAASnB,WAAWoB,WAAW,QAAQ,mBAAmB;AAC1D,SAAyBpB,WAAWqB,IAAI,QAAQ,YAAY"}
|
|
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 { default as BufferList } from './BufferList.ts';\nexport {\n allocBuffer,\n allocBufferUnsafe,\n bufferCompare,\n bufferConcat,\n bufferEquals,\n bufferFrom,\n bufferSliceCopy,\n createInflateRawStream,\n inflateRaw,\n isNaN,\n objectAssign,\n readUInt64LE,\n setImmediateFn,\n writeUInt64LE,\n} from './compat.ts';\nexport { crc32, crc32Region, verifyCrc32, verifyCrc32Region } from './crc32.ts';\nexport { default as EntryStream } from './EntryStream.ts';\nexport { type CleanupFn, default as Lock } from './Lock.ts';\nexport { default as normalizePath } from './normalizePath.ts';\nexport { default as streamToString, type StreamToStringCallback } from './streamToString.ts';\n"],"names":["default","BufferList","allocBuffer","allocBufferUnsafe","bufferCompare","bufferConcat","bufferEquals","bufferFrom","bufferSliceCopy","createInflateRawStream","inflateRaw","isNaN","objectAssign","readUInt64LE","setImmediateFn","writeUInt64LE","crc32","crc32Region","verifyCrc32","verifyCrc32Region","EntryStream","Lock","normalizePath","streamToString"],"mappings":"AAAA;;;;;;;;;;CAUC,GAED,SAASA,WAAWC,UAAU,QAAQ,kBAAkB;AACxD,SACEC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,eAAe,EACfC,sBAAsB,EACtBC,UAAU,EACVC,KAAK,EACLC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,aAAa,QACR,cAAc;AACrB,SAASC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,iBAAiB,QAAQ,aAAa;AAChF,SAASnB,WAAWoB,WAAW,QAAQ,mBAAmB;AAC1D,SAAyBpB,WAAWqB,IAAI,QAAQ,YAAY;AAC5D,SAASrB,WAAWsB,aAAa,QAAQ,qBAAqB;AAC9D,SAAStB,WAAWuB,cAAc,QAAqC,sBAAsB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize archive entry path
|
|
3
|
+
*
|
|
4
|
+
* - Converts backslashes to forward slashes
|
|
5
|
+
* - Removes empty segments
|
|
6
|
+
* - Removes leading slashes
|
|
7
|
+
*
|
|
8
|
+
* Node 0.8+ compatible.
|
|
9
|
+
*/ export default function normalizePath(p) {
|
|
10
|
+
// Split on both forward and back slashes, filter empty segments, rejoin with forward slash
|
|
11
|
+
const segments = p.split(/[/\\]/);
|
|
12
|
+
const result = [];
|
|
13
|
+
for(let i = 0; i < segments.length; i++){
|
|
14
|
+
if (segments[i].length > 0) {
|
|
15
|
+
result.push(segments[i]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result.join('/');
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/normalizePath.ts"],"sourcesContent":["/**\n * Normalize archive entry path\n *\n * - Converts backslashes to forward slashes\n * - Removes empty segments\n * - Removes leading slashes\n *\n * Node 0.8+ compatible.\n */\n\nexport default function normalizePath(p: string): string {\n // Split on both forward and back slashes, filter empty segments, rejoin with forward slash\n const segments = p.split(/[/\\\\]/);\n const result: string[] = [];\n for (let i = 0; i < segments.length; i++) {\n if (segments[i].length > 0) {\n result.push(segments[i]);\n }\n }\n return result.join('/');\n}\n"],"names":["normalizePath","p","segments","split","result","i","length","push","join"],"mappings":"AAAA;;;;;;;;CAQC,GAED,eAAe,SAASA,cAAcC,CAAS;IAC7C,2FAA2F;IAC3F,MAAMC,WAAWD,EAAEE,KAAK,CAAC;IACzB,MAAMC,SAAmB,EAAE;IAC3B,IAAK,IAAIC,IAAI,GAAGA,IAAIH,SAASI,MAAM,EAAED,IAAK;QACxC,IAAIH,QAAQ,CAACG,EAAE,CAACC,MAAM,GAAG,GAAG;YAC1BF,OAAOG,IAAI,CAACL,QAAQ,CAACG,EAAE;QACzB;IACF;IACA,OAAOD,OAAOI,IAAI,CAAC;AACrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read entire stream content as string
|
|
3
|
+
*
|
|
4
|
+
* Handles both flowing streams and streams that have already
|
|
5
|
+
* buffered data (using readable stream semantics).
|
|
6
|
+
*
|
|
7
|
+
* Node 0.8+ compatible.
|
|
8
|
+
*/
|
|
9
|
+
export type StreamToStringCallback = (error?: Error, result?: string) => undefined;
|
|
10
|
+
export default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read entire stream content as string
|
|
3
|
+
*
|
|
4
|
+
* Handles both flowing streams and streams that have already
|
|
5
|
+
* buffered data (using readable stream semantics).
|
|
6
|
+
*
|
|
7
|
+
* Node 0.8+ compatible.
|
|
8
|
+
*/ import oo from 'on-one';
|
|
9
|
+
import { bufferFrom } from './compat.js';
|
|
10
|
+
export default function streamToString(stream, callback) {
|
|
11
|
+
const chunks = [];
|
|
12
|
+
// Handle data from the stream
|
|
13
|
+
stream.on('data', (chunk)=>{
|
|
14
|
+
if (typeof chunk === 'string') {
|
|
15
|
+
chunks.push(bufferFrom(chunk, 'utf8'));
|
|
16
|
+
} else {
|
|
17
|
+
chunks.push(chunk);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
// Handle stream end events using on-one for Node 0.8 compatibility
|
|
21
|
+
oo(stream, [
|
|
22
|
+
'error',
|
|
23
|
+
'end',
|
|
24
|
+
'close'
|
|
25
|
+
], (err)=>{
|
|
26
|
+
if (err) {
|
|
27
|
+
callback(err);
|
|
28
|
+
} else {
|
|
29
|
+
const content = Buffer.concat(chunks).toString('utf8');
|
|
30
|
+
callback(null, content);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
// Ensure stream is flowing (in case it's paused)
|
|
34
|
+
if (typeof stream.resume === 'function') {
|
|
35
|
+
stream.resume();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/shared/streamToString.ts"],"sourcesContent":["/**\n * Read entire stream content as string\n *\n * Handles both flowing streams and streams that have already\n * buffered data (using readable stream semantics).\n *\n * Node 0.8+ compatible.\n */\n\nimport oo from 'on-one';\nimport { bufferFrom } from './compat.ts';\n\nexport type StreamToStringCallback = (error?: Error, result?: string) => undefined;\n\nexport default function streamToString(stream: NodeJS.ReadableStream, callback: StreamToStringCallback): void {\n const chunks: Buffer[] = [];\n\n // Handle data from the stream\n stream.on('data', (chunk: Buffer | string) => {\n if (typeof chunk === 'string') {\n chunks.push(bufferFrom(chunk, 'utf8'));\n } else {\n chunks.push(chunk);\n }\n });\n\n // Handle stream end events using on-one for Node 0.8 compatibility\n oo(stream, ['error', 'end', 'close'], (err?: Error) => {\n if (err) {\n callback(err);\n } else {\n const content = Buffer.concat(chunks).toString('utf8');\n callback(null, content);\n }\n });\n\n // Ensure stream is flowing (in case it's paused)\n if (typeof (stream as NodeJS.ReadStream).resume === 'function') {\n (stream as NodeJS.ReadStream).resume();\n }\n}\n"],"names":["oo","bufferFrom","streamToString","stream","callback","chunks","on","chunk","push","err","content","Buffer","concat","toString","resume"],"mappings":"AAAA;;;;;;;CAOC,GAED,OAAOA,QAAQ,SAAS;AACxB,SAASC,UAAU,QAAQ,cAAc;AAIzC,eAAe,SAASC,eAAeC,MAA6B,EAAEC,QAAgC;IACpG,MAAMC,SAAmB,EAAE;IAE3B,8BAA8B;IAC9BF,OAAOG,EAAE,CAAC,QAAQ,CAACC;QACjB,IAAI,OAAOA,UAAU,UAAU;YAC7BF,OAAOG,IAAI,CAACP,WAAWM,OAAO;QAChC,OAAO;YACLF,OAAOG,IAAI,CAACD;QACd;IACF;IAEA,mEAAmE;IACnEP,GAAGG,QAAQ;QAAC;QAAS;QAAO;KAAQ,EAAE,CAACM;QACrC,IAAIA,KAAK;YACPL,SAASK;QACX,OAAO;YACL,MAAMC,UAAUC,OAAOC,MAAM,CAACP,QAAQQ,QAAQ,CAAC;YAC/CT,SAAS,MAAMM;QACjB;IACF;IAEA,iDAAiD;IACjD,IAAI,OAAO,AAACP,OAA6BW,MAAM,KAAK,YAAY;QAC7DX,OAA6BW,MAAM;IACtC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extract-base-iterator",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
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
|
"lodash.compact": "^3.0.1",
|
|
50
50
|
"mkdirp-classic": "^0.5.3",
|
|
51
51
|
"next-tick": "^1.1.0",
|
|
52
|
+
"on-one": "^1.0.0",
|
|
52
53
|
"pako": "~1.0.11",
|
|
53
54
|
"queue-cb": "^1.6.3",
|
|
54
55
|
"readable-stream": "^2.3.8",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"@types/node": "*",
|
|
60
61
|
"cr": "^0.1.0",
|
|
61
62
|
"fs-iterator": "^6.1.12",
|
|
62
|
-
"fs-stats-spys": "^1.
|
|
63
|
+
"fs-stats-spys": "^1.0.0",
|
|
63
64
|
"node-version-use": "*",
|
|
64
65
|
"pinkie-promise": "*",
|
|
65
66
|
"ts-dev-stack": "*",
|