Comparing version 1.4.4 to 1.4.5-lts.1
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": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
7
0
27638
411
2
+ Addedbusboy@1.6.0(transitive)
+ Addedstreamsearch@1.1.0(transitive)
- Removedon-finished@^2.3.0
- Removedbusboy@0.2.14(transitive)
- Removeddicer@0.2.5(transitive)
- Removedee-first@1.1.1(transitive)
- Removedisarray@0.0.1(transitive)
- Removedon-finished@2.4.1(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedstreamsearch@0.1.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
Updatedbusboy@^1.0.0