mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 06:30:53 +03:00
add a test
This commit is contained in:
@@ -14,14 +14,14 @@ module.exports = async function(req, res) {
|
||||
'WWW-Authenticate': `send-v1 ${req.nonce}`
|
||||
});
|
||||
const file_stream = storage.get(id);
|
||||
let sentBytes = 0;
|
||||
let cancelled = false;
|
||||
|
||||
req.on('close', () => (cancelled = true));
|
||||
req.on('close', () => {
|
||||
cancelled = true;
|
||||
file_stream.destroy();
|
||||
});
|
||||
|
||||
file_stream.on('data', c => (sentBytes += c.length));
|
||||
|
||||
file_stream.on('end', async () => {
|
||||
file_stream.on('close', async () => {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user