mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 08:27:26 -05:00
67a21bdc69
[misc] use stream.pipeline in express libraries GitOrigin-RevId: a6a50864552237b0c4d153d9f272cdc8d0f297ea
57 lines
1.4 KiB
Diff
57 lines
1.4 KiB
Diff
diff --git a/node_modules/express/node_modules/send/index.js b/node_modules/express/node_modules/send/index.js
|
|
index 89afd7e..de56daf 100644
|
|
--- a/node_modules/express/node_modules/send/index.js
|
|
+++ b/node_modules/express/node_modules/send/index.js
|
|
@@ -789,29 +789,29 @@ SendStream.prototype.stream = function stream (path, options) {
|
|
// pipe
|
|
var stream = fs.createReadStream(path, options)
|
|
this.emit('stream', stream)
|
|
- stream.pipe(res)
|
|
-
|
|
- // cleanup
|
|
- function cleanup () {
|
|
- destroy(stream, true)
|
|
- }
|
|
-
|
|
- // response finished, cleanup
|
|
- onFinished(res, cleanup)
|
|
-
|
|
- // error handling
|
|
- stream.on('error', function onerror (err) {
|
|
- // clean up stream early
|
|
- cleanup()
|
|
-
|
|
- // 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') } })
|
|
+
|
|
+ // // cleanup
|
|
+ // function cleanup () {
|
|
+ // destroy(stream, true)
|
|
+ // }
|
|
+ //
|
|
+ // // response finished, cleanup
|
|
+ // onFinished(res, cleanup)
|
|
+ //
|
|
+ // // error handling
|
|
+ // stream.on('error', function onerror (err) {
|
|
+ // // clean up stream early
|
|
+ // cleanup()
|
|
+ //
|
|
+ // // error
|
|
+ // self.onStatError(err)
|
|
+ // })
|
|
+ //
|
|
+ // // end
|
|
+ // stream.on('end', function onend () {
|
|
+ // self.emit('end')
|
|
+ // })
|
|
}
|
|
|
|
/**
|