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

File and Directory Watch Functionality for the FileSystem API #123

Open
WEBPerformace opened this issue May 23, 2023 · 1 comment
Open
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@WEBPerformace
Copy link

WEBPerformace commented May 23, 2023

Hello,

I'd like to suggest the addition of a feature to the FileSystem API that would allow watching for changes in files and directories.

I've seen it mentioned many times in the comments for issues in this repository that are not directly related to this problem, but I did not find a specific issue specifically for that.

This ability is an essential component in many types of applications, including IDEs, file managers, photo/video editors, ML dataset managers, syncing apps, and any web app that uses its own type of file browser.

The lack of a file system API that includes watching capabilities can limit the effectiveness of native web apps, pushing developers towards heavier client applications or Electron-based solutions. Many projects could become PWAs instead of heavier client applications if this feature was implemented.

There are workaround solutions currently being used, such as maintaining a local list of files and checking that against the directory listing or recursively iterating over all files. However, these solutions can be resource-intensive and aren't as efficient or reliable as native events could be.

The need for this feature extends beyond web apps. For example, a i've seen expressed interest in being notified when a device like a USB hard disk or pen is plugged into the system. Additionally, this would significantly benefit browser-based debuggers.

Most OSes include their APIs for watching file changes, such as ReadDirectoryChangesW and ReadDirectoryChangesExW on Windows or the File System Events API on MacOS. Leveraging these APIs could potentially reduce the time needed for implementation.

Thank you for considering this feature request. The addition of a file and directory watch functionality to the FileSystem API would undoubtedly empower developers to create more robust and efficient web apps.

@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels May 31, 2023
@a-sully
Copy link
Collaborator

a-sully commented Jun 6, 2023

I agree this is useful! This idea has extensive prior discussion at WICG/file-system-access#72, though that discussion is focused primarily on watching the local file system, while I believe this capability is also useful for the Bucket File System (a.k.a. Origin Private File System)

A proposal for a new FileSystemObserver interface is here: #124 (I expect to merge the PR soon)

inexorabletash pushed a commit that referenced this issue Jun 7, 2023
Proposal for a new interface which allows a website to be notified of changes to files and directories.

See #123 and WICG/file-system-access#72
nathanmemmott pushed a commit to nathanmemmott/fs that referenced this issue Jul 18, 2024
Defines the FileSystemObserver API, an API to observe file system
change events.

See whatwg#123 and WICG/file-system-access#72
nathanmemmott pushed a commit to nathanmemmott/fs that referenced this issue Jul 19, 2024
Defines the FileSystemObserver API, an API to observe file system
change events.

See whatwg#123 and WICG/file-system-access#72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

3 participants