Closed dechowdev closed 3 years ago
A quick and easy solution is actually supplying the blob with data, I had wrongly assumed that by generating a blob that would suffice, but the data with an additional mime/type is required. Not easy to remember if you don't fiddle with blobs every day ;)
E.g. this could be a simple text file with a stringified empty JSON object (or text "hello world")
const blob = new Blob(['{}'], { type: 'text/plain'});
Closing as issue is fixed
Thanks for sharing the solution to your problem. Just noting that you can create an empty file by passing new Blob([''], { type: 'text/plain'})
.
Hi,
I have tried within a little application to render the
window.showSaveFilePicker
utilising thefileSave
method of the ponyfill. However I cannot seem to circumvent the issue of not being able to provide a blob (even with i utilizenew Blob
the promise errors)Are there any tips on how to utilize the fileSave method without passing a blob, as I would like to generate a file on the users machine - in the same manner as it's possible with the Text Editor sample.
https://github.com/GoogleChromeLabs/browser-fs-access/blob/94f651a3d4f7a9220c89c49e5158cefd444cbf9f/src/fs-access/file-save.mjs#L23