DEV Community

syntheticperson
syntheticperson

Posted on

How to create file handle without using showSaveFilePicker()?

Hello,
I'm writing a chrome extension that lets you select images on a web page, and save them to a user specified local directory using showSaveFilePicker().
I want to save a text file with the source URL of the image in it.
Currently I got code working where you manually specify the image file and the image source text locations with the follwing code:

`fileHandle = await window.showSaveFilePicker();

save(blob, fileHandle);

fileTextHandle = await window.showSaveFilePicker();

save(URLtextFileBlob, fileTextHandle);`

However, I want to automatically create a file handle based on the name of the image with ".txt" appended.

Is there a way to create a file handle without using showSaveFilePicker()?

Thanks

Top comments (0)