node-modules / compressing

Everything you need for compressing and uncompressing
MIT License
428 stars 36 forks source link

[Feature Request] #103

Closed Saya47 closed 3 months ago

Saya47 commented 3 months ago

Please add support folder destination to be a buffer! So instead of writing the compressed file to a path, we can store it in a buffer.

Example:

// compress a file to buffer
compressing.gzip.compressFile('file/path/to/compress', buffer)
.then(compressDone)
.catch(handleError);
fengmk2 commented 3 months ago

Use the stream mode can get a gzip stream then read it into Buffer array.

const gzipStream = new compressing.gzip.FileStream({ source: 'file/path/to/compress' });
const gzipChunks = [];
for await (const chunk of gzipStream) {
  gzipChunks.push(chunk);
}
console.log(gzipChunks);