I'm using latest version of AWS-s3-zipper to download complete s3 folder if its get downloaded files were corrupted,
and if user cancel the downloading before completion, if hold RAM and did not release it.
steps -
create simple NodeJs Express server with download api -
hit the /download/{gameId} where game Id is the folder of s3 bucket
it will start the downloading
here is the code -
app.get("/download/:gameId", async (req, res, next) => { try { const { gameId } = req.params; const params = { Bucket: config.bucket.name, Prefix:cloudpokernight/${gameId}`,
};
const command = new ListObjectsV2Command(params);
const data = await s3.send(command);
if (!data || !data.Contents || data.Contents.length === 0) {
return res.status(404).json({ code: 404, error: 'Folder not found in S3' });
}
res.set("content-type", "application/zip");
res.set("Content-Disposition", `attachment; filename=${gameId}.zip`);
zipper.streamZipDataTo(
{
pipe: res,
folderName: params.Prefix,
startKey: null,
recursive: true,
},
function (err, result) {
if (err) console.error(err);
else {
console.log(result);
}
},
);
I'm using latest version of AWS-s3-zipper to download complete s3 folder if its get downloaded files were corrupted, and if user cancel the downloading before completion, if hold RAM and did not release it.
steps - create simple NodeJs Express server with download api - hit the /download/{gameId} where game Id is the folder of s3 bucket it will start the downloading
here is the code -
app.get("/download/:gameId", async (req, res, next) => { try { const { gameId } = req.params; const params = { Bucket: config.bucket.name, Prefix:
cloudpokernight/${gameId}`, }; const command = new ListObjectsV2Command(params); const data = await s3.send(command);} catch (err) { next(err); } });`