multer-s3 icon indicating copy to clipboard operation
multer-s3 copied to clipboard

What if a upload is cancelled in the middle? How to delete 0 byte file created on the bucket?

Open leopucci opened this issue 3 years ago • 4 comments

I am having a problem when the user cancels the upload in the middle. It generates a 0 byte file version inside S3 bucket. Does anybody knows how to delete this file upon user cancelation? Thanks

leopucci avatar Feb 02 '22 15:02 leopucci

Seems that the request on close event gets fired upon cancelation of the upload.

  req.on('close', () => {
    console.log('req closed by client');
    // delete most recent file ?
  });

So I was wondering. Can´t I upload the Content-MD5 header of the file and prevent this 0 byte from happenning? How can I upload the Content-MD5? Anybody?

leopucci avatar Feb 02 '22 18:02 leopucci

Related... https://github.com/expressjs/multer/issues/259

leopucci avatar Feb 02 '22 19:02 leopucci

Related https://github.com/anacronw/multer-s3/issues/32

leopucci avatar Feb 04 '22 17:02 leopucci

Maybe in some way disable the multi-part upload. It seems that using s3.upload the multipart upload happens, different from s3.putObject.. I Also tried changing the part size but did not worked I don´t know why

leopucci avatar Feb 22 '22 12:02 leopucci