编辑:我认为这是由于我的虚拟机空间不足。也很好奇,当 adm-zip 写入新的 zip 时,它不会从本地目录(源)中删除文件并将它们写入 Zip 文件夹(目标)吗?
我正在尝试使用adm-zip压缩文件夹并遇到以下错误。这是一个已知的错误 ?还是我在做一些愚蠢的事情?
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)
我的代码如下所示:
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 命令给出以下大小。
525688 /tmp/unzippedBuild/lambda