
downloads.download deletes file?
I'm writing an extendion wich needs to download a file:
```js
let url = URL.createObjectURL(new Blob([content + '\n']));
try { const id = await browser.downloads.download( { filename: "some_name", saveAs: false, conflictAction: "overwrite", url: url } );
await browser.downloads.erase({id: id}); } finally { URL.revokeObjectURL(url); }
```
If the file does not exist yet, it works great. If the file exists but is exactly the same, it still works. But if there is a need to override the file with different content, the file gets deleted and it is not being replaced.
According to inotifywait, the new file IS created, but immediately deleted.
Do I understand something wrong? What am I supposed to do?
I'm writing an extendion wich needs to download a file:
```js
let url = URL.createObjectURL(new Blob([content + '\n']));
try {
const id = await browser.downloads.download(
{
filename: "some_name",
saveAs: false,
conflictAction: "overwrite",
url: url
}
);
await browser.downloads.erase({id: id});
} finally {
URL.revokeObjectURL(url);
}
```
If the file does not exist yet, it works great. If the file exists but is exactly the same, it still works. But if there is a need to override the file with different content, the file gets deleted and it is not being replaced.
According to inotifywait, the new file IS created, but immediately deleted.
Do I understand something wrong? What am I supposed to do?