Socket
Socket
Sign inDemoInstall

express-fileupload

Package Overview
Dependencies
3
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.2.1

8

example/README.md

@@ -14,2 +14,5 @@ # express-fileupload Examples

app.post('/upload', function(req, res) {
let sampleFile;
let uploadPath;
if (!req.files || Object.keys(req.files).length === 0) {

@@ -20,6 +23,7 @@ return res.status(400).send('No files were uploaded.');

// The name of the input field (i.e. "sampleFile") is used to retrieve the uploaded file
let sampleFile = req.files.sampleFile;
sampleFile = req.files.sampleFile;
uploadPath = __dirname + '/somewhere/on/your/server/' + sampleFile.name;
// Use the mv() method to place the file somewhere on your server
sampleFile.mv('/somewhere/on/your/server/filename.jpg', function(err) {
sampleFile.mv(uploadPath, function(err) {
if (err)

@@ -26,0 +30,0 @@ return res.status(500).send(err);

@@ -60,2 +60,11 @@ const Busboy = require('busboy');

: memHandler(options, field, filename); // Upload into RAM.
const writePromise = options.useTempFiles
? getWritePromise().catch(err => {
req.unpipe(busboy);
req.resume();
cleanup();
next(err);
}) : getWritePromise();
// Define upload timer.

@@ -78,3 +87,3 @@ const uploadTimer = new UploadTimer(options.uploadTimeout, () => {

debugLog(options, `Aborting upload because of size limit ${field}->${filename}.`);
closeConnection(413, options.responseOnLimit);
!isFunc(options.limitHandler) ? closeConnection(413, options.responseOnLimit) : '';
cleanup();

@@ -119,3 +128,3 @@ }

}
req[waitFlushProperty].push(getWritePromise());
req[waitFlushProperty].push(writePromise);
});

@@ -148,6 +157,2 @@

next();
}).catch(err => {
delete req[waitFlushProperty];
debugLog(options, `Error while waiting files flush: ${err}`);
next(err);
});

@@ -154,0 +159,0 @@ });

{
"name": "express-fileupload",
"version": "1.2.0",
"version": "1.2.1",
"author": "Richard Girges <richardgirges@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Simple express file upload middleware that wraps around Busboy",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc