Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lib/types/multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var RE_BOUNDARY = /^boundary$/i,
RE_CHARSET = /^charset$/i,
RE_FILENAME = /^filename$/i,
RE_NAME = /^name$/i;
RE_WIDTH = /^width$/i;
RE_HEIGHT = /^height$/i;

Multipart.detect = /^multipart\/form-data/i;
function Multipart(boy, cfg) {
Expand Down Expand Up @@ -128,6 +130,8 @@ function Multipart(boy, cfg) {
charset,
encoding,
filename,
width,
height,
nsize = 0;

if (header['content-type']) {
Expand Down Expand Up @@ -155,11 +159,18 @@ function Multipart(boy, cfg) {
for (i = 0, len = parsed.length; i < len; ++i) {
if (RE_NAME.test(parsed[i][0])) {
fieldname = parsed[i][1];
} else if (RE_FILENAME.test(parsed[i][0])) {
}
if (RE_FILENAME.test(parsed[i][0])) {
filename = parsed[i][1];
if (!preservePath)
filename = basename(filename);
}
if(RE_WIDTH.test(parsed[i][0])){
width = parseFloat(parsed[i][1])
}
if(RE_HEIGHT.test(parsed[i][0])){
height = parseFloat(parsed[i][1])
}
}
} else
return skipPart(part);
Expand Down Expand Up @@ -211,7 +222,7 @@ function Multipart(boy, cfg) {
cb();
}
};
boy.emit('file', fieldname, file, filename, encoding, contype);
boy.emit('file', fieldname, file, filename, encoding, contype, width, height);

onData = function(data) {
if ((nsize += data.length) > fileSizeLimit) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ "name": "busboy",
"version": "0.3.1",
"version": "0.3.2",
"author": "Brian White <[email protected]>",
"description": "A streaming parser for HTML form data for node.js",
"main": "./lib/main",
Expand Down