Skip to content

Commit

Permalink
handle unpipeing, cancelling or destroying of busboy accordingly (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Jun 9, 2022
1 parent 4ca6370 commit e41a643
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/types/multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ function Multipart (boy, cfg) {
++nends
const file = new FileStream(fileOpts)
curFile = file
boy.on('unpipe', function () {
file.destroy()
})
boy.on('cancel', function () {
file.destroy()
})
boy.on('destroy', function () {
file.destroy()
})
file.on('end', function () {
--nends
self._pause = false
Expand Down

0 comments on commit e41a643

Please sign in to comment.