Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

downloads.download deletes file?

  • Không có trả lời
  • 0 gặp vấn đề này
more options

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?

Bạn phải đăng nhập vào tài khoản của bạn để trả lời bài viết. Vui lòng bắt đầu một câu hỏi mới, nếu bạn chưa có tài khoản.