fixes readableStream fuckery, needs testing

This commit is contained in:
RealBeepMcJeep 2023-08-30 08:27:16 -07:00
parent baac38f888
commit b91bc21d60
1 changed files with 2 additions and 1 deletions

View File

@ -5250,6 +5250,7 @@ app.post('/asset_download', jsonParser, async (request, response) => {
const inputCategory = request.body.category;
const inputFilename = sanitize(request.body.filename);
const validCategories = ["bgm", "ambient"];
const fetch = require('node-fetch').default;
// Check category
let category = null;
@ -5285,7 +5286,7 @@ app.post('/asset_download', jsonParser, async (request, response) => {
});
}
const fileStream = fs.createWriteStream(destination, { flags: 'wx' });
await finished(Readable.fromWeb(res.body).pipe(fileStream));
await finished(res.body.pipe(fileStream));
// Move into asset place
console.debug("Download finished, moving file from", temp_path, "to", file_path);