fix: close before streaming

This commit is contained in:
monoid 2024-04-16 21:24:27 +09:00
parent 76d1c6b33d
commit 0f233183ac
1 changed files with 6 additions and 2 deletions

View File

@ -94,11 +94,15 @@ async function renderZipImage(ctx: Context, path: string, page: number) {
}, },
})); }));
nodeReadableStream.on("error", (err) => { nodeReadableStream.on("error", (err) => {
console.error(err); console.error("readalbe stream error",err);
releaseZip(path); setTimeout(()=>{
releaseZip(path)
},100);
}); });
nodeReadableStream.on("close", () => { nodeReadableStream.on("close", () => {
setTimeout(()=>{
releaseZip(path); releaseZip(path);
},100);
}); });
ctx.body = nodeReadableStream; ctx.body = nodeReadableStream;