Skip to content
Merged
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
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function busboy (options) {
}
}

function fastifyMultipart (fastify, options = {}, done) {
function fastifyMultipart (fastify, options, done) {
if (options.addToBody === true) {
if (typeof options.sharedSchemaId === 'string') {
fastify.addSchema({
Expand Down Expand Up @@ -223,10 +223,10 @@ function fastifyMultipart (fastify, options = {}, done) {

const busboyOptions = deepmerge.all([{ headers: req.headers }, options || {}, opts || {}])
const stream = busboy(busboyOptions)
var completed = false
var files = 0
var count = 0
var callDoneOnNextEos = false
let completed = false
let files = 0
let count = 0
let callDoneOnNextEos = false

req.on('error', function (err) {
stream.destroy()
Expand Down
14 changes: 7 additions & 7 deletions test/big.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ test('should upload a big file in constant memory', { skip: process.env.CI }, fu
})

fastify.listen(0, function () {
var knownLength = 1024 * 1024 * 1024
var total = knownLength
var form = new FormData({ maxDataSize: total })
var rs = new Readable({
const knownLength = 1024 * 1024 * 1024
let total = knownLength
const form = new FormData({ maxDataSize: total })
const rs = new Readable({
read (n) {
if (n > total) {
n = total
}

var buf = Buffer.alloc(n).fill('x')
const buf = Buffer.alloc(n).fill('x')
hashInput.update(buf)
this.push(buf)

Expand All @@ -72,7 +72,7 @@ test('should upload a big file in constant memory', { skip: process.env.CI }, fu
knownLength
})

var opts = {
const opts = {
protocol: 'http:',
hostname: 'localhost',
port: fastify.server.address().port,
Expand All @@ -81,7 +81,7 @@ test('should upload a big file in constant memory', { skip: process.env.CI }, fu
method: 'POST'
}

var req = http.request(opts, () => { fastify.close(noop) })
const req = http.request(opts, () => { fastify.close(noop) })

pump(form, req, function (err) {
t.error(err, 'client pump: no err')
Expand Down
Loading