Comparing version 1.5.0 to 2.0.0
2.0.0 / 2022-09-16 | ||
================== | ||
**others** | ||
* [[`d33789a`](http://github.com/cojs/busboy/commit/d33789a2af0b04fb9a68b1016a70857fc5f3c584)] - BREAKING CHANGE: update busboy to 1.x and node 14.x (#48) (TZ | 天猪 <<atian25@qq.com>>) | ||
1.5.0 / 2021-04-12 | ||
@@ -3,0 +9,0 @@ ================== |
35
index.js
@@ -32,3 +32,3 @@ var Busboy = require('busboy') | ||
var busboy = new Busboy(options) | ||
var busboy = Busboy(options) | ||
@@ -39,9 +39,9 @@ request = inflate(request) | ||
busboy | ||
.on('field', onField) | ||
.on('file', onFile) | ||
.on('close', cleanup) | ||
.on('error', onEnd) | ||
.on('finish', onEnd) | ||
.on('field', onField) | ||
.on('file', onFile) | ||
.on('close', cleanup) | ||
.on('error', onEnd) | ||
.on('finish', onEnd) | ||
busboy.on('partsLimit', function(){ | ||
busboy.on('partsLimit', function () { | ||
var err = new Error('Reach parts limit') | ||
@@ -53,3 +53,3 @@ err.code = 'Request_parts_limit' | ||
busboy.on('filesLimit', function(){ | ||
busboy.on('filesLimit', function () { | ||
var err = new Error('Reach files limit') | ||
@@ -61,3 +61,3 @@ err.code = 'Request_files_limit' | ||
busboy.on('fieldsLimit', function(){ | ||
busboy.on('fieldsLimit', function () { | ||
var err = new Error('Reach fields limit') | ||
@@ -80,3 +80,5 @@ err.code = 'Request_fields_limit' | ||
function onField(name, val, fieldnameTruncated, valTruncated) { | ||
function onField(name, val, info) { | ||
var fieldnameTruncated = info.nameTruncated | ||
var valTruncated = info.valueTruncated | ||
if (checkField) { | ||
@@ -89,3 +91,3 @@ var err = checkField(name, val, fieldnameTruncated, valTruncated) | ||
var args = [name, val, fieldnameTruncated, valTruncated] | ||
var args = [ name, val, fieldnameTruncated, valTruncated ] | ||
@@ -98,6 +100,6 @@ if (options.autoFields) { | ||
var prev = field[name] | ||
if (prev == null) return field[name] = val | ||
var prev = field[ name ] | ||
if (prev == null) return field[ name ] = val | ||
if (isArray(prev)) return prev.push(val) | ||
field[name] = [prev, val] | ||
field[ name ] = [ prev, val ] | ||
} else { | ||
@@ -108,3 +110,6 @@ ch(args) | ||
function onFile(fieldname, file, filename, encoding, mimetype) { | ||
function onFile(fieldname, file, info) { | ||
var filename = info.filename | ||
var encoding = info.encoding | ||
var mimetype = info.mimeType | ||
if (checkFile) { | ||
@@ -111,0 +116,0 @@ var err = checkFile(fieldname, file, filename, encoding, mimetype) |
{ | ||
"name": "co-busboy", | ||
"description": "Busboy multipart parser as a yieldable", | ||
"version": "1.5.0", | ||
"version": "2.0.0", | ||
"author": { | ||
@@ -20,5 +20,8 @@ "name": "Jonathan Ong", | ||
}, | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
}, | ||
"dependencies": { | ||
"black-hole-stream": "~0.0.1", | ||
"busboy": "^0.2.8", | ||
"busboy": "^1.6.0", | ||
"chan": "^0.6.1", | ||
@@ -28,10 +31,10 @@ "inflation": "^2.0.0" | ||
"devDependencies": { | ||
"c8": "^7.12.0", | ||
"co": "^4.6.0", | ||
"formstream": "~1.0.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^4.0.1" | ||
"formstream": "^1.0.0", | ||
"mocha": "^10.0.0" | ||
}, | ||
"scripts": { | ||
"test": "NODE_ENV=test mocha --harmony --reporter spec --bail", | ||
"test-cov": "NODE_ENV=test istanbul cover -x test.js _mocha -- --reporter spec --bail" | ||
"test": "mocha **/*.test.js", | ||
"ci": "c8 npm test" | ||
}, | ||
@@ -38,0 +41,0 @@ "files": [ |
12113
121
+ Addedbusboy@1.6.0(transitive)
+ Addedstreamsearch@1.1.0(transitive)
- Removedbusboy@0.2.14(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddicer@0.2.5(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@0.0.1(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedstreamsearch@0.1.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
Updatedbusboy@^1.6.0