anacronw/multer-s3

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

Opened this issue · 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

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?

Related #32

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