Description
I sometimes get some confusing question on github issues as i most often have to guess what method of choices they use in order to save the files.
there are currently 3 method in place, 1) native 2) service worker 3) building a blob
So it gets a bit hard to trying figuring out the path it takes.
so i want to switch out _preferPolyfill: false
to preferedMethods
const fileHandle = await showSaveFilePicker({
- _preferPolyfill: false
+ _preferedMethods: [
+ 'native', // req native support for window.showSaveFilePicker
+ 'service-worker', // requires installing a service worker to allow streaming large files
+ 'constructing-blob' // easiest/oldest method that req. more RAM but is fine for smaller file
+ ],
suggestedName: "Untitled.png",
types: [
{ accept: { "image/png": ["png"] } },
{ accept: { "image/jpg": ["jpg"] } },
{ accept: { "image/webp": ["webp"] } },
],
excludeAcceptAllOption: false, // default
});
Perhaps later then we could maybe even throw in dropbox and google drive methods into the mix then if something like that ever comes up
Originally posted by @jimmywarting in #59 (comment)
i want service-worker
to be explicitly opted out as it requires more things to be set up in order to work correctly.
and i also want this field to be required and not fallback to any default methods. so _preferedMethods
will be a required field. But that would maybe perhaps be a too breaking change. perhaps maybe just do a console.warn()
and set the default to using ['native', 'constructing-blob']
A problem with not using prefered method are that the service worker solution might not just work if folks install a service worker. cuz we only do feature detection by the occurrences if a service worker is installed or not. not by the fact that they have implemented the push algoritm.