我想调整图像大小并将其上传到 s3 存储桶。
我尝试multer-s3-transform
了模块,但它没有用。
我尝试过使用它,但它也没有奏效。
const upload = multer({
fileFilter: fileFilter,
storage: multerS3({
s3: s3,
bucket: 'bucket',
acl: 'public-read',
shouldTransform: function(req, file, cb) {
cb(null, /^image/i.test(file.mimetype));
},
transforms: [
{
id: 'original',
transform: function(req, file, cb) {
//Perform desired transformations
cb(
null,
sharp()
.resize(600, 600)
.max()
);
}
}
]
})
});