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

Metadata and Content-Disposition

Open KevinLu opened this issue 4 years ago • 10 comments

Will this library support Metadata and Content-Disposition?

I've tried adding Content-Disposition like this:

var upload = multer({
    storage: multerS3({
        s3: s3,
        Bucket: s3Bucket,
        ContentType: multerS3.AUTO_CONTENT_TYPE,
        ContentDisposition: 'attachment',
        Key: (req, file, cb) => {
            cb(null, file.originalname);
        }
    }),
    fileFilter: mediaFilter
});

but in my S3 bucket, the metadata Content-Disposition does not get added.

S3 Upload Property has Content-Disposition as one of its properties.

Looking forward to this.

KevinLu avatar Jun 01 '20 01:06 KevinLu

How did you guys used the AUTO_CONTENT_TYPE from 'multer-s3', i can't get it done correctly, ContentType is throwing a typescript error and when i silence it, it throws this error "Expected params.ContentType to be a string"

rramiachraf avatar Aug 16 '20 17:08 rramiachraf

How did you guys used the AUTO_CONTENT_TYPE from 'multer-s3', i can't get it done correctly, ContentType is throwing a typescript error and when i silence it, it throws this error "Expected params.ContentType to be a string"

Sorry, when I tested this further. I got the same error as you. AUTO_CONTENT_TYPE is not implemented in multer-sharp-s3 so there's no hope of getting that working. Did you ever find a fix for this?

KevinLu avatar Dec 24 '20 00:12 KevinLu

Unfortunately not, I just abandoned both of multer-s3 and multer-sharp-s3 and I just used raw aws-sdk with sharp and it's even better.

rramiachraf avatar Dec 25 '20 22:12 rramiachraf

Unfortunately not, I just abandoned both of multer-s3 and multer-sharp-s3 and I just used raw aws-sdk with sharp and it's even better.

Yup, that's what I did do. AWS sdk on its own with Sharp seems to work a lot better.

KevinLu avatar Dec 27 '20 22:12 KevinLu

Hi @KevinLu, thanks for addressing this issue. for contentType, this lib has a default value if you don't specify it will check based on your file type. for the ContentDisposition, this lib not supported it yet. I will check if I have spare time.

ikhsanalatsary avatar Feb 07 '21 12:02 ikhsanalatsary

Hi @KevinLu, thanks for addressing this issue. for contentType, this lib has a default value if you don't specify it will check based on your file type. for the ContentDisposition, this lib not supported it yet. I will check if I have spare time.

Thanks for the response, let me know if you've gotten it sorted out. I'd love to give this package another try.

KevinLu avatar Feb 08 '21 02:02 KevinLu

@rramiachraf @KevinLu Can you guys share an example code? I'd like to go with aws-sdk and sharp too. Since this package is not maintained anymore.

ozgrozer avatar Nov 24 '21 22:11 ozgrozer

@ozgrozer here you go man, https://github.com/rramiachraf/buffalo/blob/main/backend/src/rest/updatePoster.ts

rramiachraf avatar Nov 25 '21 10:11 rramiachraf

@rramiachraf Thank you for the code. It helped me a lot.

I also made a clean version of it and posted to Stack Overflow. Thought it might help other people who are struggling with the same issue.

https://stackoverflow.com/a/70114704/1340552

ozgrozer avatar Nov 25 '21 16:11 ozgrozer

Thank you for addressing this issue. I think there's a missing in this lib 😃 . If you don't mind and can fix this. PR is always welcome. FYI, I just published v.0.2.2.

ikhsanalatsary avatar Feb 15 '22 09:02 ikhsanalatsary