I've been searching everywhere, and all examples lead to fs.createWriteStream
which is not what I want.
I'm using the archiver
package, and would like to use archive.pipe()
to pipe to a writeable stream that is not a file, but rather a buffer that I can use to send to s3.putObject
to write to an S3 bucket. How do I set up a buffer that I can pipe to?
When I run the code below, I get "Error: not implemented".
const stream = require('stream');
const archiver = require('archiver');
const archive = archiver('zip');
const outputStream = new stream.Writable();
outputStream.on('close', () => {
console.log('done');
});
outputStream.on('error', err => {
console.error(err);
});
archive.pipe(outputStream);
archive.append('Testing 1 2 3', { name: 'file1.txt' });
archive.finalize();