const blob = new Blob();
saveFileToDisk(blob, 'Some-File.txt')
async saveFileToDisk({blob, fileName}){
try {
const fileHandle = await self.showSaveFilePicker({
suggestedName: fileName,
types: [
{
description: "File",
},
],
});
const writeFile = async (fileHandle, contents) => {
const writable = await fileHandle.createWritable();
await writable.write(contents);
await writable.close();
};
writeFile(fileHandle, blob).then(() => console.log("FILE DOWNLOADED!!!"));
} catch (error) {
console.log(error);
}
}