feat(classes.smartarchive): Support URL streams, recursive archive unpacking and filesystem export; improve ZIP/GZIP/BZIP2 robustness; CI and package metadata updates

This commit is contained in:
2025-08-18 01:29:06 +00:00
parent ed5f590b5f
commit 780db4921e
23 changed files with 812 additions and 622 deletions

View File

@@ -26,7 +26,13 @@ export function unbzip2Stream() {
chunk.push(b);
};
streamCRC = bzip2Instance.decompress(bitReader, f, buf, bufsize, streamCRC);
streamCRC = bzip2Instance.decompress(
bitReader,
f,
buf,
bufsize,
streamCRC,
);
if (streamCRC === null) {
// reset for next bzip2 header
blockSize = 0;
@@ -66,7 +72,10 @@ export function unbzip2Stream() {
return bufferQueue.shift();
});
}
while (!broken && hasBytes - bitReader.bytesRead + 1 >= (25000 + 100000 * blockSize || 4)) {
while (
!broken &&
hasBytes - bitReader.bytesRead + 1 >= (25000 + 100000 * blockSize || 4)
) {
//console.error('decompressing with', hasBytes - bitReader.bytesRead + 1, 'bytes in buffer');
const result = await decompressAndPush();
if (!result) {
@@ -86,7 +95,8 @@ export function unbzip2Stream() {
await streamTools.push(result);
}
if (!broken) {
if (streamCRC !== null) this.emit('error', new Error('input stream ended prematurely'));
if (streamCRC !== null)
this.emit('error', new Error('input stream ended prematurely'));
}
},
});