Hiển thị các bài đăng có nhãn zip memory. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn zip memory. Hiển thị tất cả bài đăng

Crete ZIP file in memory

Source: https://medium.com/@harrietty/zipping-and-unzipping-files-with-nodejs-375d2750c5e4

https://stackoverflow.com/questions/42992604/crete-zip-file-in-memory-using-any-node-module

If GZip will do, you can use the built-in zlib module and not even have to load an external module.
const zlib = require('zlib');
const gzip = zlib.createGzip();
// If you have an inputStream and an outputStream:

inputStream.pipe(gzip).pipe(outputStream);
For Zip and not GZip, you can check out archiver or zip-stream.

All the unzipping for all the files


const fs = require('fs');
const zlib = require('zlib');
const directoryFiles = fs.readdirSync('./data');
directoryFiles.forEach(filename => {
const fileContents = fs.createReadStream(`./data/${filename}`);
const writeStream = fs.createWriteStream(`./data/${filename.slice(0, -3)}`);
const unzip = zlib.createGunzip();
fileContents.pipe(unzip).pipe(writeStream);
});

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...