I am using the getDirectoryHandle and getFileHandle APIs. I want to save a picture in the specified directory. I have the base64 data of the picture, but I don’t know how to save the base64 as a picture
const hDir = await showDirectoryPicker(); const hImageFile = await hDir.getFileHandle("test.png", { create: true, }); const w$ = await hImageFile.createWritable(); await w$.write( canvas.toDataURL('image/png') ); await w$.close(); I tried:
await w$.write( atob(canvas.toDataURL('image/png')) ); but the saved picture is not recognized.