![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
multer-aws-s3
Advanced tools
AWS S3 storage engine for multer.
$ npm install --save multer-aws-s3
var multer = require('multer')
var AWS = require('aws-sdk')
var S3Storage = require('multer-aws-s3')
// AWS setup here...
var upload = multer({
storage: new S3Storage({
basepath: '/remote/path',
s3: new AWS.S3({ params: { Bucket: 'myBucket' } })
})
})
By default random filenames are chosen (crypto.randomBytes
), you can change this behavior however by using a custom destination
function:
// Demonstrates destination that uses sha1 digest of file
var multer = require('multer')
var crypto = require('crypto')
var AWS = require('aws-sdk')
var S3Storage = require('multer-aws-s3')
var upload = multer({
storage: new S3Storage({
destination: function (req, file, options, callback) {
var digest = crypto.createHash('sha1')
digest.setEncoding('hex')
file.stream.pipe(digest)
file.stream.on('end', function () {
digest.end()
callback(null, digest.read())
})
},
s3: new AWS.S3({ params: { Bucket: 'myBucket' } })
})
})
var multer = require('multer')
var AWS = require('aws-sdk')
var S3Storage = require('multer-aws-s3')
var upload = multer({
storage: new S3Storage({
basepath: '/remote/path', // base path for keys in the bucket
s3: new AWS.S3({ params: { Bucket: 'myBucket' } }), // `aws-sdk` S3 instance
destination: function (req, file, options, callback) {
callback(null, 'testfilename') // custom file destination, file extension is added to the end of the path
},
transformFile: function (req, file, callback) {
// transform the file before uploading it
// file.stream is a ReadableStream of the file
// callback(error, < ReadableStream | Buffer | String >)
callback(null, file.stream)
}
})
})
Write tests
FAQs
AWS S3 storage engine for multer
The npm package multer-aws-s3 receives a total of 3 weekly downloads. As such, multer-aws-s3 popularity was classified as not popular.
We found that multer-aws-s3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.