diff --git a/server/models/client.js b/server/models/client.js index 1e73856e..4907ce2f 100644 --- a/server/models/client.js +++ b/server/models/client.js @@ -101,24 +101,14 @@ var client = { } } else { const tempFilename = `${hash}-${Date.now()}.tar`; - const tempFilePath = TemporaryStorage.getTempPath(tempFilename); const archive = archiver('tar', {store: true}); - const output = fs.createWriteStream(tempFilePath); - - output.on('close', () => { - const filename = `${selectedTorrent.name}.tar`; - - res.attachment(path.basename(filename)); - res.download(tempFilePath, filename, () => { - TemporaryStorage.deleteFile(tempFilename); - }); - }); archive.on('error', (error) => { throw error; }); - archive.pipe(output); + res.attachment(`${selectedTorrent.name}.tar`); + archive.pipe(res); filePathsToDownload.forEach((filePath) => { const filename = path.basename(filePath);