Accessing the Native File system

I heard about the Native File System today and thought it would be so useful for database storage.

So I had a play with it and got stuck.

The windows.chooseFileSystemEntries() keeps yelling at me,
SecurityError: Failed to execute ‘chooseFileSystemEntries’ on ‘Window’: Cross origin sub frames aren’t allowed to show a file picker.

But I have no problem running it from the console.

Could it be a CORS issue of something else?

Unfortunately this looks like it won’t be possible based on the security design of this feature:

  1. The API will deny requests for user decisions coming from 3rd-party frames.

You could petition the browser vendors to add support for this. Alternatively, it might be possible for Observable to pass-through access to native files in the future, like we’ve done for FileAttachment.

In the meantime here’s another way to read local files:

1 Like

The local files works a little but the advantage of the new native file system is, once given permission a file can be updated without further user input. This would be really useful for doing database storage.

So I hope that there will be Observable to proxy support for it (similar to how you can download JSON or CSV from cells) can be implemented.

1 Like

Agreed, this would be useful.

For example, it would be possible to allow a user to choose a local file, open the file for editing in a notebook (perhaps running a script to fetch some data), and save changes back to the local file.

1 Like

Are we in the future yet? :smiley:

1 Like