Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit f10c5b6

Browse files
committed
fixed dangling multipart stream
1 parent 19a8dae commit f10c5b6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/utils/multipart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Multipart extends Transform {
1717

1818
_flush () {
1919
this.push(Buffer.from(PADDING + this._boundary + PADDING + NEW_LINE))
20+
this.push(null)
2021
}
2122

2223
_generateBoundary () {

src/utils/send-files-stream.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module.exports = (send, path) => {
3737
}
3838

3939
const multipart = new Multipart()
40+
4041
const retStream = new Duplex({ objectMode: true })
4142

4243
retStream._read = (n) => {}
@@ -106,6 +107,10 @@ module.exports = (send, path) => {
106107
progress: options.progress
107108
}
108109

110+
multipart.on('error', (err) => {
111+
retStream.emit('error', err)
112+
})
113+
109114
request = send(args, (err, response) => {
110115
if (err) {
111116
return retStream.emit('error', err)

0 commit comments

Comments
 (0)