inline function immediately called lolwtf

This commit is contained in:
RealBeepMcJeep 2023-08-30 08:01:09 -07:00
parent 4e78c3ec79
commit 3422b3e963
1 changed files with 13 additions and 17 deletions

View File

@ -5273,7 +5273,6 @@ app.post('/asset_download', jsonParser, async (request, response) => {
try {
// Download to temp
const downloadFile = (async (url, temp_path) => {
const res = await fetch(url);
if (!res.ok) {
throw new Error(`Unexpected response ${res.statusText}`);
@ -5287,9 +5286,6 @@ app.post('/asset_download', jsonParser, async (request, response) => {
}
const fileStream = fs.createWriteStream(destination, { flags: 'wx' });
await finished(Readable.fromWeb(res.body).pipe(fileStream));
});
await downloadFile(url, temp_path);
// Move into asset place
console.debug("Download finished, moving file from", temp_path, "to", file_path);