small fix for s3

This commit is contained in:
subnub
2024-12-07 20:18:00 -05:00
parent 0eb8bf12a0
commit 7576e89bba
2 changed files with 7 additions and 3 deletions
@@ -78,7 +78,8 @@ class S3Actions implements IStorageActions {
{ Bucket: bucket, Body: passThrough, Key: randomID },
(err) => {
if (err) {
console.log("S3 upload err", err);
emitter.emit("error", err);
return;
}
emitter.emit("finish");
}
@@ -134,17 +134,20 @@ const processData = (
reject(e);
});
cipher.pipe(writeStream);
if (emitter) {
emitter.on("finish", () => {
resolve({ filename, metadata });
});
emitter.on("error", (e: Error) => {
reject(e);
});
} else {
writeStream.on("finish", () => {
resolve({ filename, metadata });
});
}
cipher.pipe(writeStream);
}
);
};