Edit: I think this is due to my vm running out of space. Also curious, when adm-zip writes into a new zip doesn't it remove the files from the local directory(soruce) and write them into Zip folder (destination) ?
I'm trying to zip a folder using adm-zip and running into the following error. Is this a known bug ? Or Am I doing something dumb ?
INFO started zipping from source: /tmp/unzippedBuild/lambda to destination: /tmp/postBuild.zip
ERROR RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 65535. Received 92171
at checkInt (internal/buffer.js:35:11)
at writeU_Int16LE (internal/buffer.js:539:3)
at Buffer.writeUInt16LE (internal/buffer.js:547:10)
at Object.toBinary (/var/task/node_modules/adm-zip/headers/mainHeader.js:73:15)
at Object.compressToBuffer (/var/task/node_modules/adm-zip/zipFile.js:305:24)
at Object.writeZip (/var/task/node_modules/adm-zip/adm-zip.js:618:23)
at Object.exports.makeZip (/var/task/utils/zipHelper.js:20:13)
at Runtime.exports.buildHandler [as handler] (/var/task/index.js:31:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
My code looks like this:
exports.makeZip = function(source, destination) {
console.info("started zipping from source: %s to destination: %s", source, destination);
try {
const zip = new AdmZip();
zip.addLocalFolder(source);
zip.writeZip(destination);
console.info("done zipping");
} catch (error) {
console.error(error.stack)
console.error("Zipping failed. Reason: %s", error)
throw new Error(error.message)
}
};
du command gives the following size.
525688 /tmp/unzippedBuild/lambda