1

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.

1
  • 1
    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. Commented Jan 20, 2021 at 6:18

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.