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

Commit 1a0eafa

Browse files
committed
fixed dangling multipart stream
1 parent 8037ab7 commit 1a0eafa

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
@@ -43,6 +43,7 @@ module.exports = (send, path) => {
4343
}
4444

4545
const multipart = new Multipart()
46+
4647
const retStream = new Duplex({ objectMode: true })
4748

4849
retStream._read = (n) => {}
@@ -112,6 +113,10 @@ module.exports = (send, path) => {
112113
progress: options.progress
113114
}
114115

116+
multipart.on('error', (err) => {
117+
retStream.emit('error', err)
118+
})
119+
115120
request = send(args, (err, response) => {
116121
if (err) {
117122
return retStream.emit('error', err)

0 commit comments

Comments
 (0)