I am trying to gzip my folder with the help of Pako library. I couldn't found any related content about it. Can someone explain me how to use pako to gzip directory. I am using it in my lambda function along with EFS.
let bundle = fs.readdirSync(tempDir);
let zippedFile = pako.gzip(bundle);
My folder location looks like this data/temp/
Error
TypeError: strm.input.subarray is not a function
You can use
fs.readdirSync()
to list files in the directory, then check the stat of each file before compressing it usingfs.lstatSync()
. I have tested this locally on my mac.Then you can write the compressed file to your file system.