Skip to content

Commit e41a643

Browse files
authored
handle unpipeing, cancelling or destroying of busboy accordingly (#81)
1 parent 4ca6370 commit e41a643

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/types/multipart.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ function Multipart (boy, cfg) {
172172
++nends
173173
const file = new FileStream(fileOpts)
174174
curFile = file
175+
boy.on('unpipe', function () {
176+
file.destroy()
177+
})
178+
boy.on('cancel', function () {
179+
file.destroy()
180+
})
181+
boy.on('destroy', function () {
182+
file.destroy()
183+
})
175184
file.on('end', function () {
176185
--nends
177186
self._pause = false

0 commit comments

Comments
 (0)