mirror of
https://github.com/vector-im/element-desktop.git
synced 2024-10-03 17:42:41 +00:00
Iterate
This commit is contained in:
parent
fa1941278e
commit
c2871033c2
1 changed files with 4 additions and 1 deletions
|
@ -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…
Reference in a new issue