Comparing version 0.1.6 to 0.1.7
16
index.js
@@ -7,2 +7,3 @@ var os = require('os'); | ||
var mkdirp = require('mkdirp'); | ||
var is = require('type-is'); | ||
var qs = require('qs'); | ||
@@ -42,7 +43,3 @@ | ||
if (req.headers['content-type'] && | ||
req.headers['content-type'].indexOf('multipart/form-data') === 0 && | ||
(req.method === 'POST' || req.method === 'PUT') | ||
) { | ||
if (is(req, ['multipart'])) { | ||
if (options.onParseStart) { options.onParseStart(); } | ||
@@ -123,4 +120,6 @@ | ||
fileStream.on('data', function(data) { | ||
if (data) { file.size += data.length; } | ||
if (options.inMemory) bufs.push(data); | ||
if (data) { | ||
if (options.inMemory) bufs.push(data); | ||
file.size += data.length; | ||
} | ||
// trigger "file data" event | ||
@@ -133,4 +132,5 @@ if (options.onFileUploadData) { options.onFileUploadData(file, data); } | ||
if (!req.files[fieldname]) { req.files[fieldname] = []; } | ||
if (options.inMemory) file.buffer = Buffer.concat(bufs); | ||
if (options.inMemory) file.buffer = Buffer.concat(bufs, file.size); | ||
req.files[fieldname].push(file); | ||
// trigger "file end" event | ||
@@ -137,0 +137,0 @@ if (options.onFileUploadComplete) { options.onFileUploadComplete(file); } |
{ | ||
"name": "multer", | ||
"description": "Middleware for handling `multipart/form-data`.", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"contributors": [ | ||
@@ -22,3 +22,4 @@ "Hage Yaapa <captain@hacksparrow.com> (http://www.hacksparrow.com)" | ||
"mkdirp": "~0.3.5", | ||
"qs": "~1.2.2" | ||
"qs": "~1.2.2", | ||
"type-is": "~1.5.2" | ||
}, | ||
@@ -28,5 +29,4 @@ "devDependencies": { | ||
"co": "^3.0.6", | ||
"express": "^4.9.5", | ||
"mocha": "^1.21.4", | ||
"qs": "^2.2.4", | ||
"express": "*", | ||
"mocha": "*", | ||
"rimraf": "^2.2.8", | ||
@@ -33,0 +33,0 @@ "supertest": "^0.13.0" |
@@ -30,3 +30,3 @@ # Multer [![Build Status](https://travis-ci.org/expressjs/multer.svg?branch=master)](https://travis-ci.org/expressjs/multer) [![NPM version](https://badge.fury.io/js/multer.svg)](https://badge.fury.io/js/multer) | ||
**IMPORTANT**: Multer will not process any form which is not `multipart/form-data` submitted via the `POST` or `PUT` methods. | ||
**IMPORTANT**: Multer will not process any form which is not `multipart/form-data`. | ||
@@ -125,3 +125,3 @@ ## Multer file object | ||
If this Boolean value is true, the file.buffer property holds the data in-memory that Multer would have written to disk. The dest option is still populated and the path property contains the proposed path to save the file. Defaults to `false`. | ||
If this Boolean value is `true`, the `file.buffer` property holds the data in-memory that Multer would have written to disk. The dest option is still populated and the path property contains the proposed path to save the file. Defaults to `false`. | ||
@@ -132,2 +132,4 @@ ```js | ||
**WARNING**: Uploading very large files, or relatively small files in large numbers very quickly, can cause your application to run out of memory when `inMemory` is set to`tue`. | ||
### rename(fieldname, filename) | ||
@@ -134,0 +136,0 @@ |
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
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
16595
6
261
4
+ Addedtype-is@~1.5.2
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmime-db@1.12.0(transitive)
+ Addedmime-types@2.0.14(transitive)
+ Addedtype-is@1.5.7(transitive)