Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multer

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multer - npm Package Compare versions

Comparing version 1.4.4 to 1.4.5-lts.1

22

lib/make-middleware.js
var is = require('type-is')
var Busboy = require('busboy')
var extend = require('xtend')
var onFinished = require('on-finished')
var appendField = require('append-field')

@@ -12,6 +11,2 @@

function drainStream (stream) {
stream.on('readable', stream.read.bind(stream))
}
function makeMiddleware (setup) {

@@ -34,3 +29,3 @@ return function multerMiddleware (req, res, next) {

try {
busboy = new Busboy({ headers: req.headers, limits: limits, preservePath: preservePath })
busboy = Busboy({ headers: req.headers, limits: limits, preservePath: preservePath })
} catch (err) {

@@ -50,8 +45,5 @@ return next(err)

isDone = true
req.unpipe(busboy)
drainStream(req)
busboy.removeAllListeners()
onFinished(req, function () { next(err) })
next(err)
}

@@ -86,5 +78,5 @@

// handle text field data
busboy.on('field', function (fieldname, value, fieldnameTruncated, valueTruncated) {
busboy.on('field', function (fieldname, value, { nameTruncated, valueTruncated }) {
if (fieldname == null) return abortWithCode('MISSING_FIELD_NAME')
if (fieldnameTruncated) return abortWithCode('LIMIT_FIELD_KEY')
if (nameTruncated) return abortWithCode('LIMIT_FIELD_KEY')
if (valueTruncated) return abortWithCode('LIMIT_FIELD_VALUE', fieldname)

@@ -101,3 +93,3 @@

// handle files
busboy.on('file', function (fieldname, fileStream, filename, encoding, mimetype) {
busboy.on('file', function (fieldname, fileStream, { filename, encoding, mimeType }) {
// don't attach to the files object, if there is no file

@@ -115,3 +107,3 @@ if (!filename) return fileStream.resume()

encoding: encoding,
mimetype: mimetype
mimetype: mimeType
}

@@ -178,3 +170,3 @@

busboy.on('fieldsLimit', function () { abortWithCode('LIMIT_FIELD_COUNT') })
busboy.on('finish', function () {
busboy.on('close', function () {
readFinished = true

@@ -181,0 +173,0 @@ indicateDone()

{
"name": "multer",
"description": "Middleware for handling `multipart/form-data`.",
"version": "1.4.4",
"version": "1.4.5-lts.1",
"contributors": [

@@ -23,7 +23,6 @@ "Hage Yaapa <captain@hacksparrow.com> (http://www.hacksparrow.com)",

"append-field": "^1.0.0",
"busboy": "^0.2.11",
"busboy": "^1.0.0",
"concat-stream": "^1.5.2",
"mkdirp": "^0.5.4",
"object-assign": "^4.1.1",
"on-finished": "^2.3.0",
"type-is": "^1.6.4",

@@ -43,3 +42,3 @@ "xtend": "^4.0.0"

"engines": {
"node": ">= 0.10.0"
"node": ">= 6.0.0"
},

@@ -46,0 +45,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc