feat(classes.smartarchive): Support URL web streams, add recursive archive unpacking and filesystem export, and improve ZIP decompression robustness
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartarchive',
|
||||
version: '4.0.39',
|
||||
version: '4.1.0',
|
||||
description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
|
||||
}
|
||||
|
@@ -60,7 +60,12 @@ export class SmartArchive {
|
||||
return this.sourceStream;
|
||||
}
|
||||
if (this.sourceUrl) {
|
||||
const urlStream = await plugins.smartrequest.getStream(this.sourceUrl);
|
||||
const response = await plugins.smartrequest.SmartRequest.create()
|
||||
.url(this.sourceUrl)
|
||||
.get();
|
||||
const webStream = response.stream();
|
||||
// @ts-ignore - Web stream to Node.js stream conversion
|
||||
const urlStream = plugins.stream.Readable.fromWeb(webStream);
|
||||
return urlStream;
|
||||
}
|
||||
if (this.sourceFilePath) {
|
||||
|
@@ -19,9 +19,9 @@ class DecompressZipTransform extends plugins.smartstream.SmartDuplex<ArrayBuffer
|
||||
constructor() {
|
||||
super({
|
||||
objectMode: true,
|
||||
writeFunction: async (chunkArg: Buffer, streamtoolsArg) => {
|
||||
writeFunction: async (chunkArg, streamtoolsArg) => {
|
||||
this.streamtools? null : this.streamtools = streamtoolsArg;
|
||||
this.unzipper.push(chunkArg, false);
|
||||
this.unzipper.push(Buffer.isBuffer(chunkArg) ? chunkArg : Buffer.from(chunkArg), false);
|
||||
},
|
||||
finalFunction: async () => {
|
||||
this.unzipper.push(Buffer.from(''), true);
|
||||
|
Reference in New Issue
Block a user