mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 19:13:38 -05:00
67a21bdc69
[misc] use stream.pipeline in express libraries GitOrigin-RevId: a6a50864552237b0c4d153d9f272cdc8d0f297ea
61 lines
1.5 KiB
Diff
61 lines
1.5 KiB
Diff
diff --git a/node_modules/send/index.js b/node_modules/send/index.js
|
|
index 06d7507..8854216 100644
|
|
--- a/node_modules/send/index.js
|
|
+++ b/node_modules/send/index.js
|
|
@@ -795,31 +795,31 @@ SendStream.prototype.stream = function stream (path, options) {
|
|
// pipe
|
|
var stream = fs.createReadStream(path, options)
|
|
this.emit('stream', stream)
|
|
- stream.pipe(res)
|
|
-
|
|
- // response finished, done with the fd
|
|
- onFinished(res, function onfinished () {
|
|
- finished = true
|
|
- destroy(stream)
|
|
- })
|
|
-
|
|
- // error handling code-smell
|
|
- stream.on('error', function onerror (err) {
|
|
- // request already finished
|
|
- if (finished) return
|
|
-
|
|
- // clean up stream
|
|
- finished = true
|
|
- destroy(stream)
|
|
-
|
|
- // error
|
|
- self.onStatError(err)
|
|
- })
|
|
-
|
|
- // end
|
|
- stream.on('end', function onend () {
|
|
- self.emit('end')
|
|
- })
|
|
+ Stream.pipeline(stream, res, err => { if (err) { self.onStatError(err) } else { self.emit('end') } })
|
|
+
|
|
+ // // response finished, done with the fd
|
|
+ // onFinished(res, function onfinished () {
|
|
+ // finished = true
|
|
+ // destroy(stream)
|
|
+ // })
|
|
+ //
|
|
+ // // error handling code-smell
|
|
+ // stream.on('error', function onerror (err) {
|
|
+ // // request already finished
|
|
+ // if (finished) return
|
|
+ //
|
|
+ // // clean up stream
|
|
+ // finished = true
|
|
+ // destroy(stream)
|
|
+ //
|
|
+ // // error
|
|
+ // self.onStatError(err)
|
|
+ // })
|
|
+ //
|
|
+ // // end
|
|
+ // stream.on('end', function onend () {
|
|
+ // self.emit('end')
|
|
+ // })
|
|
}
|
|
|
|
/**
|