multiparty
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -0,1 +1,5 @@ | ||
### 2.1.3 | ||
* add `file.size` | ||
### 2.1.2 | ||
@@ -2,0 +6,0 @@ |
@@ -6,3 +6,2 @@ var http = require('http') | ||
, Batch = require('batch') | ||
, StreamCounter = require('stream-counter') | ||
, PORT = process.env.PORT || 27372 | ||
@@ -54,4 +53,2 @@ | ||
var counter = new StreamCounter(); | ||
part.pipe(counter); // need this until knox upgrades to streams2 | ||
headers['Content-Length'] = part.byteCount; | ||
@@ -64,6 +61,2 @@ s3Client.putStream(part, destPath, headers, function(err, s3Response) { | ||
}); | ||
part.on('end', function() { | ||
console.log("part end"); | ||
console.log("size", counter.bytes); | ||
}); | ||
}); | ||
@@ -70,0 +63,0 @@ form.on('close', onEnd); |
@@ -11,2 +11,3 @@ exports.Form = Form; | ||
, StringDecoder = require('string_decoder').StringDecoder | ||
, StreamCounter = require('stream-counter') | ||
@@ -485,2 +486,4 @@ var START = 0 | ||
fileStream.pipe(file.ws); | ||
var counter = new StreamCounter(); | ||
fileStream.pipe(counter); | ||
var hashWorkaroundStream | ||
@@ -503,2 +506,3 @@ , hash = null; | ||
if (hash) file.hash = hash.digest('hex'); | ||
file.size = counter.bytes; | ||
self.emit('file', fileStream.name, file); | ||
@@ -505,0 +509,0 @@ endFlush(self); |
{ | ||
"name": "multiparty", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "multipart/form-data parser which supports streaming", | ||
@@ -17,5 +17,5 @@ "keywords": [ | ||
"request": "~2.16.6", | ||
"mkdirp": "~0.3.5" | ||
"mkdirp": "~0.3.5", | ||
"superagent": "~0.14.1" | ||
}, | ||
"main": "./lib/incoming_form.js", | ||
"scripts": { | ||
@@ -29,4 +29,5 @@ "test": "mocha --reporter spec --recursive test/test.js" | ||
"dependencies": { | ||
"readable-stream": "~1.0.2" | ||
"readable-stream": "~1.0.2", | ||
"stream-counter": "~0.1.0" | ||
} | ||
} |
@@ -150,3 +150,4 @@ [![Build Status](https://travis-ci.org/superjoe30/node-multiparty.png?branch=master)](https://travis-ci.org/superjoe30/node-multiparty) | ||
- `path` - the absolute path of the uploaded file on disk | ||
- `headers - the HTTP headers that were sent along with this file | ||
- `headers` - the HTTP headers that were sent along with this file | ||
- `size` - size of the file in bytes | ||
@@ -153,0 +154,0 @@ If you set the `form.hash` option, then `file` will also contain a `hash` |
module.exports['menu_seperator.png.http'] = [ | ||
{type: 'file', name: 'image', filename: 'menu_separator.png', fixture: 'menu_separator.png', | ||
sha1: 'c845ca3ea794be298f2a1b79769b71939eaf4e54'} | ||
{ | ||
type: 'file', | ||
name: 'image', | ||
filename: 'menu_separator.png', | ||
fixture: 'menu_separator.png', | ||
sha1: 'c845ca3ea794be298f2a1b79769b71939eaf4e54', | ||
size: 931, | ||
} | ||
]; | ||
module.exports['beta-sticker-1.png.http'] = [ | ||
{type: 'file', name: 'sticker', filename: 'beta-sticker-1.png', fixture: 'beta-sticker-1.png', | ||
sha1: '6abbcffd12b4ada5a6a084fe9e4584f846331bc4'} | ||
{ | ||
type: 'file', | ||
name: 'sticker', | ||
filename: 'beta-sticker-1.png', | ||
fixture: 'beta-sticker-1.png', | ||
sha1: '6abbcffd12b4ada5a6a084fe9e4584f846331bc4', | ||
size: 1660, | ||
} | ||
]; | ||
module.exports['blank.gif.http'] = [ | ||
{type: 'file', name: 'file', filename: 'blank.gif', fixture: 'blank.gif', | ||
sha1: 'a1fdee122b95748d81cee426d717c05b5174fe96'} | ||
{ | ||
type: 'file', | ||
name: 'file', | ||
filename: 'blank.gif', | ||
fixture: 'blank.gif', | ||
sha1: 'a1fdee122b95748d81cee426d717c05b5174fe96', | ||
size: 49, | ||
} | ||
]; | ||
module.exports['binaryfile.tar.gz.http'] = [ | ||
{type: 'file', name: 'file', filename: 'binaryfile.tar.gz', fixture: 'binaryfile.tar.gz', | ||
sha1: 'cfabe13b348e5e69287d677860880c52a69d2155'} | ||
{ | ||
type: 'file', | ||
name: 'file', | ||
filename: 'binaryfile.tar.gz', | ||
fixture: 'binaryfile.tar.gz', | ||
sha1: 'cfabe13b348e5e69287d677860880c52a69d2155', | ||
size: 301, | ||
} | ||
]; | ||
module.exports['plain.txt.http'] = [ | ||
{type: 'file', name: 'file', filename: 'plain.txt', fixture: 'plain.txt', | ||
sha1: 'b31d07bac24ac32734de88b3687dddb10e976872'} | ||
{ | ||
type: 'file', | ||
name: 'file', | ||
filename: 'plain.txt', | ||
fixture: 'plain.txt', | ||
sha1: 'b31d07bac24ac32734de88b3687dddb10e976872', | ||
size: 23, | ||
} | ||
]; | ||
module.exports['pf1y5.png.http'] = [ | ||
{type: 'field', name: 'path'}, | ||
{type: 'file', name: 'upload', filename: 'pf1y5.png', fixture: 'pf1y5.png', | ||
sha1: '805cc640c5b182e86f2b5c8ebf34ecf063cd34fd'} | ||
{ | ||
type: 'field', | ||
name: 'path', | ||
}, | ||
{ | ||
type: 'file', | ||
name: 'upload', | ||
filename: 'pf1y5.png', | ||
fixture: 'pf1y5.png', | ||
sha1: '805cc640c5b182e86f2b5c8ebf34ecf063cd34fd', | ||
size: 768323, | ||
} | ||
]; |
@@ -5,6 +5,15 @@ var properFilename = 'funkyfilename.txt'; | ||
return [ | ||
{type: 'field', name: 'title', value: 'Weird filename'}, | ||
{type: 'file', name: 'upload', filename: filename, fixture: properFilename}, | ||
{ | ||
type: 'field', | ||
name: 'title', | ||
value: 'Weird filename', | ||
}, | ||
{ | ||
type: 'file', | ||
name: 'upload', | ||
filename: filename, | ||
fixture: properFilename, | ||
}, | ||
]; | ||
}; | ||
} | ||
@@ -11,0 +20,0 @@ var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; |
@@ -70,3 +70,4 @@ var spawn = require('child_process').spawn | ||
assert.equal(file.originalFilename, expectedPart.filename); | ||
if(expectedPart.sha1) assert.equal(file.hash, expectedPart.sha1); | ||
if(expectedPart.sha1) assert.strictEqual(file.hash, expectedPart.sha1); | ||
if(expectedPart.size) assert.strictEqual(file.size, expectedPart.size); | ||
} | ||
@@ -73,0 +74,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
3560983
51
1180
161
2
6
11
+ Addedstream-counter@~0.1.0
+ Addedstream-counter@0.1.0(transitive)