Reputation: 11
I've found this https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API to allow javascript to access the local file system. I feel really dumb, but I can't find anywhere that talks about how to actually add the api. I would really appreciate some help on just getting the first step.
Upvotes: 1
Views: 821
Reputation: 2514
You can feature-detect the File System Access API like so:
if ('showOpenFilePicker' in window) {
// The File System Access API is supported.
}
On supporting browsers, this will evaluate to true
. In order to use the API, see the MDN docs you linked to in your question and/or check out our article.
We maintain a library that uses the API if it is available and that transparently falls back to previous approaches like <input type="file">
or <a download>
on non-supporting browsers. You can read up on ithere if you are interested.
Upvotes: 1
Reputation: 35011
You don't need to add the API; it's already there, or it isn't. There is a chart on the page with information about browsers and support versions.
I am using this with Chrome. Firefox is supposed to support it but it doesn't have it on my local box... My version may be too old.
Upvotes: 1