This commit is contained in:
Eradev
2025-02-02 03:10:32 -05:00
parent 842b59605b
commit 055a6527fc
14 changed files with 28 additions and 51 deletions

View File

@@ -165,9 +165,7 @@ export function formatBytes(bytes) {
*/
export async function extractFileFromZipBuffer(archiveBuffer, fileExtension) {
return await new Promise((resolve, reject) => yauzl.fromBuffer(Buffer.from(archiveBuffer), { lazyEntries: true }, (err, zipfile) => {
if (err) {
reject(err);
}
if (err) reject(err);
zipfile.readEntry();
zipfile.on('entry', (entry) => {
@@ -469,9 +467,8 @@ export function forwardFetchResponse(from, to) {
from.body.pipe(to);
to.socket.on('close', function () {
if (from.body instanceof Readable) {
from.body.destroy(); // Close the remote stream
}
if (from.body instanceof Readable) from.body.destroy(); // Close the remote stream
to.end(); // End the Express response
});