Is there any node module to create zip in memory?(I don't want to save zip file on disk) so that we can send this created zip file to other server(From memory). What is the best way to do this? Here is my example:
var file_system = require('fs');
var archiver = require('archiver');
var dirToCompress = 'directoryToZIP';
module.exports = function (req, res, next) {
var archive = archiver.create('zip', {});
archive.on('error', function (err) {
throw err;
});
var output = file_system.createWriteStream('/testDir/myZip.zip',{flags:'a'});//I don't want this line
output.on('close', function () {
console.log(archive.pointer() + ' total bytes');
console.log('archiver has been finalized and the output file descriptor has closed.');
});
archive.pipe(output);
archive.directory(dirToCompress);
archive.finalize();
};