Skip to content

Commit

Permalink
Use close event instead of finish of busboy
Browse files Browse the repository at this point in the history
  • Loading branch information
ostec-mh committed Aug 9, 2022
1 parent 71a44dd commit 485136d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function (req, dest, fnDestFilename, opts = {}) {

fileStream.pipe(fs.createWriteStream(tmpPath))
.on('error', reject)
.on('finish', () => {
.on('close', () => {
let rs = fs.createReadStream(tmpPath)
rs.fieldname = fieldname
rs.filename = filename
Expand All @@ -38,7 +38,7 @@ module.exports = function (req, dest, fnDestFilename, opts = {}) {
appendField(fields, name, value)
})

busboy.on('finish', () => {
busboy.on('close', () => {
if (files.length) {
Promise.all(files)
.then(files => resolve({ fields, files }))
Expand Down

0 comments on commit 485136d

Please sign in to comment.