編集:これは、vm のスペースが不足しているためだと思います。また、興味深いことに、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