
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
multi-rest
Advanced tools
version v1.4 has a back compatibility with old version but prefered to update
Multi rest is a swiss knife for handling multi-part requests for restify , and as all nodejs framework is use http server at the end so I built this as if I'm dealing with http request, this module can handle diffrent file and process them.
- Path handler.
- File naming.
- Upload more then one file in the same request.
- Thumbnails for images & videos.
- S3 support for AWS.
- Upload certain extensions.
- Handling multiple files under the same fieldname.
- ......
const restify = require('restify');
const Multi = require('multi-rest');
var server = restify.createServer();
var upload = new Multi({
uploadDir: "./uploads/",
filename: 'random',
filefields: ['video'],
extensions: ['mp4'],
thumbnail: {type: 'video'},
used: 'maybe'});
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.use(restify.CORS());
server.post('/upload', upload ,function (req, res, next){
res.send({success: true, files: req.files, message: "file uploaded :)"});
});
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
});
check how to configure AWS-SDK for Nodejs
You need to create AWS credentials to ~/.aws/credentials
[default]
aws_access_key_id = your_access_key
aws_secret_access_key = your_secret_key
const restify = require('restify');
const Multi = require('multi-rest');
var server = restify.createServer();
var upload = new Multi({driver: { type: 's3',
endpoint: 's3-accelerate.amazonaws.com',
signatureVersion: 'v4',
region: 'eu-central-1',
bucketName: 'bucketName'
},
uploadDir: "uploads/",
filename: 'random',
filefields: ['video'],
extensions: ['mp4'],
thumbnail: {type: 'video'},
used: 'maybe'});
server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());
server.use(restify.CORS());
server.post('/upload', upload ,function (req, res, next){
res.send({success: true, files: req.files, message: "file uploaded :)"});
});
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
});
This use a uuid v4 library to create the file name
{ filename: 'random' }
This use the name of the uploaded file .
{ filename: 'same' }
This will add after the name of the uploaded file the timestamp when the file uploaded.
{ filename: 'plus_date' }
This use new Date() to create the file name (not prefeared when uploading more then one file)
{ filename: 'date' }
Licensed under MIT
M. Mahrous Feel free to contact me M. Mahrous and improve the code.
FAQs
A middleware to handle multi-part request for restify
The npm package multi-rest receives a total of 8 weekly downloads. As such, multi-rest popularity was classified as not popular.
We found that multi-rest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.