Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main.addon.FileSystemAccessAPI access local file system via picker dialogs #6023

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

gplanansky
Copy link
Contributor

This PR adds the one file: src/main/addon/FileSystemAccessAPI.mjs

*Basic support for the File System Access API:

Supplies methods showDirectoryPicker(), showOpenFilePicker(), showSaveFilePicker(); plus the convenience method supported() to test if a browser supports this API.

Useful Information:

The "File System API" is available in Web Workers.
However the "File System Access API" extensions are Not available in Web Workers,
because the extensions must handle user gestures and Web Workers do Not have access to the
UI thread aka main thread. Therefore we must add this support via the Neo main/addon approach,

Supported by Chrome, Edge, Opera, but not and never FireFox:
https://developer.chrome.com/docs/capabilities/web-apis/file-system-access#browser_support

Tested with Neo on Chrome, Opera, Edge.

See: https://wicg.github.io/file-system-access W3C Community File System Access Report

Reason for this support:

Quoting from the above W3C Report:

This API enables developers to build powerful apps that interact with other (non-Web) apps on the user’s device via the device’s file system. Prominent examples of applications where users expect this functionality are IDEs, photo and video editors, text editors, and more.

In particular, "more" includes data input files, user-generated annotated data output files, and user-determined session configuration state files, typical of data science and data analysis applications. For instance, GIS applications. Such "desktop" applications use the local file system extensively, to read and persist user-generated files, and do not merely display data from the cloud.

So this is a minimal addon that provides maximal support for Desktop applications.
It could also serve the purpose of a minimalist first exercise in coding main addons.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the dev branch, not the main branch

…ker(), showSaveFilePicker() and supported() See: https://wicg.github.io/file-system-access local file system handle factories.
@tobiu
Copy link
Collaborator

tobiu commented Oct 8, 2024

looks good. merging it in and will add a minor cleanup. thx george!

@tobiu tobiu merged commit 801bce4 into neomjs:dev Oct 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants