formidable
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -250,2 +250,3 @@ if (global.GENTLY) require = GENTLY.hijack(require); | ||
this.bytesExpected = parseInt(this.headers['content-length'], 10); | ||
this.emit('progress', this.bytesReceived, this.bytesExpected); | ||
} | ||
@@ -252,0 +253,0 @@ }; |
{ | ||
"name": "formidable", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"dependencies": {}, | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
# Formidable | ||
[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png)](http://travis-ci.org/felixge/node-formidable) | ||
[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable) | ||
@@ -25,2 +25,19 @@ ## Purpose | ||
### v1.0.9 | ||
* Emit progress when content length header parsed (Tim Koschützki) | ||
* Fix Readme syntax due to GitHub changes (goob) | ||
* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara) | ||
### v1.0.8 | ||
* Strip potentially unsafe characters when using `keepExtensions: true`. | ||
* Switch to utest / urun for testing | ||
* Add travis build | ||
### v1.0.7 | ||
* Remove file from package that was causing problems when installing on windows. (#102) | ||
* Fix typos in Readme (Jason Davies). | ||
### v1.0.6 | ||
@@ -129,3 +146,3 @@ | ||
sys = require('sys'); | ||
util = require('util'); | ||
@@ -139,3 +156,3 @@ http.createServer(function(req, res) { | ||
res.write('received upload:\n\n'); | ||
res.end(sys.inspect({fields: fields, files: files})); | ||
res.end(util.inspect({fields: fields, files: files})); | ||
}); | ||
@@ -160,11 +177,11 @@ return; | ||
#### new formidable.IncomingForm() | ||
__new formidable.IncomingForm()__ | ||
Creates a new incoming form. | ||
#### incomingForm.encoding = 'utf-8' | ||
__incomingForm.encoding = 'utf-8'__ | ||
The encoding to use for incoming form fields. | ||
#### incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd() | ||
__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__ | ||
@@ -175,11 +192,11 @@ The directory for placing file uploads in. You can move them later on using | ||
#### incomingForm.keepExtensions = false | ||
__incomingForm.keepExtensions = false__ | ||
If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`. | ||
#### incomingForm.type | ||
__incomingForm.type__ | ||
Either 'multipart' or 'urlencoded' depending on the incoming request. | ||
#### incomingForm.maxFieldsSize = 2 * 1024 * 1024 | ||
__incomingForm.maxFieldsSize = 2 * 1024 * 1024__ | ||
@@ -190,11 +207,11 @@ Limits the amount of memory a field (not file) can allocate in bytes. | ||
#### incomingForm.bytesReceived | ||
__incomingForm.bytesReceived__ | ||
The amount of bytes received for this form so far. | ||
#### incomingForm.bytesExpected | ||
__incomingForm.bytesExpected__ | ||
The expected number of bytes in this form. | ||
#### incomingForm.parse(request, [cb]) | ||
__incomingForm.parse(request, [cb])__ | ||
@@ -207,3 +224,3 @@ Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback: | ||
#### incomingForm.onPart(part) | ||
__incomingForm.onPart(part)__ | ||
@@ -229,11 +246,11 @@ You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing. | ||
#### Event: 'progress' (bytesReceived, bytesExpected) | ||
__Event: 'progress' (bytesReceived, bytesExpected)__ | ||
Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar. | ||
#### Event: 'field' (name, value) | ||
__Event: 'field' (name, value)__ | ||
Emitted whenever a field / value pair has been received. | ||
#### Event: 'fileBegin' (name, file) | ||
__Event: 'fileBegin' (name, file)__ | ||
@@ -244,15 +261,15 @@ Emitted whenever a new file is detected in the upload stream. Use this even if | ||
#### Event: 'file' (name, file) | ||
__Event: 'file' (name, file)__ | ||
Emitted whenever a field / file pair has been received. `file` is an instance of `File`. | ||
#### Event: 'error' (err) | ||
__Event: 'error' (err)__ | ||
Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events. | ||
#### Event: 'aborted' | ||
__Event: 'aborted'__ | ||
Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core). | ||
#### Event: 'end' () | ||
__Event: 'end' ()__ | ||
@@ -263,7 +280,7 @@ Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response. | ||
#### file.size = 0 | ||
__file.size = 0__ | ||
The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet. | ||
#### file.path = null | ||
__file.path = null__ | ||
@@ -273,11 +290,11 @@ The path this file is being written to. You can modify this in the `'fileBegin'` event in | ||
#### file.name = null | ||
__file.name = null__ | ||
The name this file had according to the uploading client. | ||
#### file.type = null | ||
__file.type = null__ | ||
The mime type of this file, according to the uploading client. | ||
#### file.lastModifiedDate = null | ||
__file.lastModifiedDate = null__ | ||
@@ -284,0 +301,0 @@ A date object (or `null`) containing the time this file was last written to. Mostly |
@@ -375,5 +375,11 @@ var common = require('../common'); | ||
form._parseContentLength(); | ||
assert.strictEqual(form.bytesReceived, null); | ||
assert.strictEqual(form.bytesExpected, null); | ||
form.headers['content-length'] = '8'; | ||
gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { | ||
assert.equal(event, 'progress'); | ||
assert.equal(bytesReceived, 0); | ||
assert.equal(bytesExpected, 8); | ||
}); | ||
form._parseContentLength(); | ||
@@ -385,2 +391,7 @@ assert.strictEqual(form.bytesReceived, 0); | ||
form.headers['content-length'] = '08'; | ||
gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { | ||
assert.equal(event, 'progress'); | ||
assert.equal(bytesReceived, 0); | ||
assert.equal(bytesExpected, 8); | ||
}); | ||
form._parseContentLength(); | ||
@@ -387,0 +398,0 @@ assert.strictEqual(form.bytesExpected, 8); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 8 instances in 1 package
1974
304
450150
49
16