-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use text-encoding npm package instead of integrated text-encoding dep. (
#50) * replace encodings * use external TextDecoder as polyfill * add information to changelog * move dependencies closer to devDependencies * add benchmark * add missing \r\n\r\n to each part * create utf8 and latin1 specific benchmarks * also encode the content of the parts * extracted createMultipartBufferForFormBench * rename createMultipartBufferForEncodingBench to createMultipartBufferForEncodingBench fix typo in Changelog * add unit test * fix linting issues * Add explicit charset * latin1 is the same as iso8859-1 but is like the unit test i wrote * use Map instead of Object,bind streamsearch onInfo directly * fix linting * fix benchmarks * revert unnecessary change for this PR * Minor cleanup Co-authored-by: Igor Savin <iselwin@gmail.com>
- Loading branch information
Showing
12 changed files
with
224 additions
and
1,795 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
# Changelog | ||
|
||
Major changes since the last busboy release (0.3.1): | ||
|
||
# 1.0.0 - TBD, 2021 | ||
|
||
* TypeScript types are now included in the package itself (#13) | ||
* Non-deprecated Buffer creation is used (#8, #10) | ||
* Error on non-number limit rather than ignoring (#7) | ||
* Dicer is now part of the busboy itself and not an external dependency (#14) | ||
* Tests were converted to Mocha (#11, #12, #22, #23) | ||
* Add isPartAFile-option, to make the file-detection configurable (#53) | ||
* Empty Parts will not hang the process (#55) | ||
* FileStreams also provide the property `bytesRead` (#51) | ||
* add and expose headerSize limit (#64) | ||
# Changelog | ||
|
||
Major changes since the last busboy release (0.3.1): | ||
|
||
# 1.0.0 - TBD, 2021 | ||
|
||
* TypeScript types are now included in the package itself (#13) | ||
* Non-deprecated Buffer creation is used (#8, #10) | ||
* Error on non-number limit rather than ignoring (#7) | ||
* Dicer is now part of the busboy itself and not an external dependency (#14) | ||
* Tests were converted to Mocha (#11, #12, #22, #23) | ||
* Using the native TextDecoder and the package 'text-decoding' for fallback if nodejs does not support the requested encoding (#50) | ||
* Add isPartAFile-option, to make the file-detection configurable (#53) | ||
* Empty Parts will not hang the process (#55) | ||
* FileStreams also provide the property `bytesRead` (#51) | ||
* add and expose headerSize limit (#64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const Busboy = require('busboy'); | ||
const { createMultipartBufferForEncodingBench } = require("./createMultipartBufferForEncodingBench"); | ||
|
||
for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var | ||
const boundary = '-----------------------------168072824752491622650073', | ||
busboy = new Busboy({ | ||
headers: { | ||
'content-type': 'multipart/form-data; boundary=' + boundary | ||
} | ||
}), | ||
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'iso-8859-1'), | ||
mb = buffer.length / 1048576; | ||
|
||
let processedData = 0; | ||
busboy.on('file', (field, file, filename, encoding, mimetype) => { | ||
file.resume() | ||
}) | ||
|
||
busboy.on('error', function (err) { | ||
}) | ||
busboy.on('finish', function () { | ||
}) | ||
|
||
const start = +new Date(); | ||
const result = busboy.write(buffer, () => { }); | ||
busboy.end(); | ||
const duration = +new Date - start; | ||
const mbPerSec = (mb / (duration / 1000)).toFixed(2); | ||
console.log(mbPerSec + ' mb/sec'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const Busboy = require('busboy'); | ||
const { createMultipartBufferForEncodingBench } = require("./createMultipartBufferForEncodingBench"); | ||
|
||
for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var | ||
const boundary = '-----------------------------168072824752491622650073', | ||
busboy = new Busboy({ | ||
headers: { | ||
'content-type': 'multipart/form-data; boundary=' + boundary | ||
} | ||
}), | ||
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'utf-8'), | ||
mb = buffer.length / 1048576; | ||
|
||
let processedData = 0; | ||
busboy.on('file', (field, file, filename, encoding, mimetype) => { | ||
file.resume() | ||
}) | ||
|
||
busboy.on('error', function (err) { | ||
}) | ||
busboy.on('finish', function () { | ||
}) | ||
|
||
const start = +new Date(); | ||
const result = busboy.write(buffer, () => { }); | ||
busboy.end(); | ||
const duration = +new Date - start; | ||
const mbPerSec = (mb / (duration / 1000)).toFixed(2); | ||
console.log(mbPerSec + ' mb/sec'); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Busboy = require('../lib/main'); | ||
const { createMultipartBufferForEncodingBench } = require("./createMultipartBufferForEncodingBench"); | ||
|
||
for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var | ||
const boundary = '-----------------------------168072824752491622650073', | ||
busboy = new Busboy({ | ||
headers: { | ||
'content-type': 'multipart/form-data; boundary=' + boundary | ||
} | ||
}), | ||
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'iso-8859-1'), | ||
mb = buffer.length / 1048576; | ||
|
||
busboy.on('file', (field, file, filename, encoding, mimetype) => { | ||
file.resume() | ||
}) | ||
|
||
busboy.on('error', function (err) { | ||
}) | ||
busboy.on('finish', function () { | ||
}) | ||
|
||
const start = +new Date(); | ||
busboy.write(buffer, () => { }); | ||
busboy.end(); | ||
const duration = +new Date - start; | ||
const mbPerSec = (mb / (duration / 1000)).toFixed(2); | ||
console.log(mbPerSec + ' mb/sec'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const Busboy = require('../lib/main'); | ||
const { createMultipartBufferForEncodingBench } = require("./createMultipartBufferForEncodingBench"); | ||
|
||
for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var | ||
const boundary = '-----------------------------168072824752491622650073', | ||
busboy = new Busboy({ | ||
headers: { | ||
'content-type': 'multipart/form-data; boundary=' + boundary | ||
} | ||
}), | ||
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'utf-8'), | ||
mb = buffer.length / 1048576; | ||
|
||
busboy.on('file', (field, file, filename, encoding, mimetype) => { | ||
file.resume() | ||
}) | ||
|
||
busboy.on('error', function (err) { | ||
}) | ||
busboy.on('finish', function () { | ||
}) | ||
|
||
const start = +new Date(); | ||
busboy.write(buffer, () => { }); | ||
busboy.end(); | ||
const duration = +new Date - start; | ||
const mbPerSec = (mb / (duration / 1000)).toFixed(2); | ||
console.log(mbPerSec + ' mb/sec'); | ||
} |
Oops, something went wrong.