stream download after headers
This commit is contained in:
parent
82b71b2af7
commit
24abf669b0
|
@ -63,19 +63,18 @@ 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', () => {
|
||||||
|
storage.forceDelete(id).then(err => {
|
||||||
file_stream.on(notLocalHost ? 'finish' : 'close', () => {
|
if (!err) {
|
||||||
storage.forceDelete(id).then(err => {
|
console.log('Deleted.');
|
||||||
if (!err) {
|
}
|
||||||
console.log('Deleted.');
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
file_stream.pipe(res);
|
file_stream.pipe(res);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
res.sendStatus(404);
|
res.sendStatus(404);
|
||||||
|
|
Loading…
Reference in New Issue