Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
multer-flydrive-engine
Advanced tools
A multer storage engine for flydrive's fluent storage interface
The flydrive storage engine gives you full control on storing files to whatever backing storage service you choose to configure through flydrive.
var storage = new StorageManager({
disks: {
local: {
driver: 'local',
root: process.cwd(),
},
s3: {
driver: 's3',
key: 'AWS_S3_KEY',
secret: 'AWS_S3_SECRET',
region: 'AWS_S3_REGION',
bucket: 'AWS_S3_BUCKET',
}
}
});
var storageEngine = FlydriveStorageEngine({
async disk (req, file) {
return req.query.dest === 's3' ? storage.disk('s3') : storage.disk('local');
},
async destination (req, file) {
return '/tmp/my-uploads';
},
async filename (req, file, cb) {
return file.fieldname + '-' + Date.now();
}
});
var upload = multer({ storage: storageEngine });
The disk
attribute is required, and there are two options available,destination
and filename
. They are all functions that determine where the file should be stored.
disk
is used to determine which flydrive disk on which to store the file. This can
also be given as a single flydrive storage disk (e.g. storage.disk()
).
destination
is used to determine within which folder the uploaded files should
be stored. This can also be given as a string
(e.g. '/tmp/uploads'
). If no
destination
is given, the disk's configured root directory is used. Since the underlying
engine is flydrive, you do not need to worry about directory creation, flydrive
will handle this for you.
filename
is used to determine what the file should be named inside the folder.
If no filename
is given, each file will be given a random name that doesn't
include any file extension.
Note: Multer will not append any file extension for you, your function should return a filename complete with an file extension.
Each function gets passed both the request (req
) and some information about
the file (file
) to aid with the decision.
Note that req.body
might not have been fully populated yet. It depends on the
order that the client transmits fields and files to the server.
FAQs
A multer storage engine for flydrive's fluent storage interface
The npm package multer-flydrive-engine receives a total of 3 weekly downloads. As such, multer-flydrive-engine popularity was classified as not popular.
We found that multer-flydrive-engine 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.