multer-s3
multer-s3 copied to clipboard
package dosent work for minio s3 compatible
as you know minio is also a s3 compatible so i used minio configuration like the following to create a s3 config :
const Minio = require('minio')
const s3= new Minio.Client({
endPoint,
useSSL: true,
accessKey,
secretKey
})
module.exports = s3
and then i used this configuration in the multer-s3 to create a storage :
const s3 = require('../../configs/up.config')
const multer = require('multer')
const multerS3 = require('multer-s3')
const storage = multerS3({
s3,
bucket: 'test',
acl: 'public-read',
contentType: multerS3.AUTO_CONTENT_TYPE,
metadata: function (req, file, cb) {
cb(null, {fieldName: file.fieldname});
},
key: function (req, file, cb) {
cb(null, Date.now().toString())
}
})
const upload = multer({ storage })
module.exports = upload.single('image')
but it dosent work and throws an error :
C:\Users\user\Desktop\example\node_modules\multer-s3\index.js:210
var upload = this.s3.upload(params)
^
TypeError: this.s3.upload is not a function
at S3Storage.<anonymous> (C:\Users\user\Desktop\example\node_modules\multer-s3\index.js:210:26)
at C:\Users\user\Desktop\example\node_modules\multer-s3\index.js:84:10
Please share information about the file that is calling this module
Please share information about the file that is calling this module
here is the route & controller :
const upload = require('../middleware/upload.js')
const app = require('express')()
app.get('/', upload, (req, res) => {
console.log(req.file)
})
Have you used the upload module in this way?
const upload = require('../middleware/upload.js')
const app = require('express')()
app.get('/', (req, res) => {
upload(req, res , (req, res) => {
console.log(req.file)
})
})
Have you used the upload module in this way?
const upload = require('../middleware/upload.js') const app = require('express')() app.get('/', (req, res) => { upload(req, res , (req, res) => { console.log(req.file) }) })
yes, that didnt help me to solve the issue.
I'm afraid that we cannot help you with Minio compatibility since that isn't something we support officially...
Per your error:
var upload = this.s3.upload(params) TypeError: this.s3.upload is not a function
It looks like the thing you passed in as s3
doesn't have an upload
function?