mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-10 12:15:34 +00:00
stream download after headers
This commit is contained in:
@@ -63,8 +63,6 @@ app.get('/assets/download/:id', (req, res) => {
|
|||||||
'Content-Type': 'application/octet-stream',
|
'Content-Type': 'application/octet-stream',
|
||||||
'Content-Length': contentLength
|
'Content-Length': contentLength
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
let file_stream = storage.get(id);
|
let file_stream = storage.get(id);
|
||||||
|
|
||||||
file_stream.on(notLocalHost ? 'finish' : 'close', () => {
|
file_stream.on(notLocalHost ? 'finish' : 'close', () => {
|
||||||
@@ -76,6 +74,7 @@ app.get('/assets/download/:id', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
file_stream.pipe(res);
|
file_stream.pipe(res);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.sendStatus(404);
|
res.sendStatus(404);
|
||||||
|
|||||||
Reference in New Issue
Block a user