forked from CringeStudios/element-desktop
Iterate
This commit is contained in:
parent
fa1941278e
commit
c2871033c2
@ -27,7 +27,10 @@ async function downloadToFile(url, filename) {
|
||||
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
|
||||
await pipeline(resp.body, fs.createWriteStream(filename));
|
||||
} catch (e) {
|
||||
await fsPromises.unlink(filename).catch();
|
||||
console.error(e);
|
||||
try {
|
||||
await fsPromises.unlink(filename);
|
||||
} catch (_) {}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user