My extension creates zip archive with images inside. And I used chrome.downloads.download to download my archive to device.
const url = URL.createObjectURL(archiveBlob);
chrome.downloads.download({
url,
filename: `${archiveData.fileName}.zip`,
saveAs: false
});
And also URL.createObjectURL required in my extension when I convert ArrayBuffer to Image
async bufferToImage(buffer: ArrayBuffer): Promise<InstanceType<typeof Image>> {
return new Promise((res, rej) => {
const blob = new Blob([buffer]);
const objectURL = URL.createObjectURL(blob);
const img = new Image();
img.src = objectURL;
img.onload = () => res(img);
});
}
How can I do it now in Manifest v3 ServiceWorker?