Open tomayac opened 4 years ago
Hidden files are part of the filesystem and should stay included in the directory listing, they are just hidden for the user. Files like .gitignore, .editorconfig, .npmrc,... are also useful and sometimes needed in a Web-based IDE .
The hidden flag seems to be very useful when you present files to the user,...
+1 for the hidden flag idea
(You can play with this code at https://github.com/GoogleChromeLabs/browser-nativefs#live-demo.)
Good question, yes, I agree that hidden files should be exposed by the API, but we probably do indeed want to somehow expose the "hidden" flag to the web. This kind feels like part of the bigger question of what other metadata about files we should expose (although "hidden" is perhaps different since it not only applies to files but also to directories).
Related question is if it should be possible to create new hidden files/directories? On platforms where the "hidden" state of a file is merely the fact that the name starts with a "." it is effectively already possible to do so, but on windows it is not currently possible. Should it be possible on windows as well?
Seems reasonable to support this on Windows, as well. We could expose an isHidden
attribute as part of the file metadata (proposed here https://github.com/whatwg/fs/issues/12) and add a new flag to getFileHandle()
, though we'd
have to specify how that behaves with the name
parameter
Most OS file pickers don't show hidden files and AFAIK there's no way to configure that programmatically (please correct me if I'm wrong)
I have some reservations about making a given file hidden, since from the perspective of the user it could appear as if the file is removed (especially if the site does not have access to the parent). Perhaps there should be some restrictions on file moves (see https://github.com/whatwg/fs/issues/10)... though remove self (https://github.com/whatwg/fs/issues/9) is soon to be supported so perhaps that's not a big deal
Anywho, this seems nice to have so I'll leave the issue open, but I don't see us prioritizing this any time soon
I think a FileSystemHandle.hidden
property would be very useful, especially for storing settings from a web app.
Should the API be aware of hidden files? Something like
.gitignore
may well be suitable for a Web-based IDE to display. FWIW, the macOS file picker preview doesn't show hidden files (even if I have decided on a system level to show them), but hidden files are then included in the directory listing (notice the missing.gitignore
in the file picker):Should a
File
object have ahidden
flag, since the UNIX convention to prefix hidden files with a.
doesn't exist on Windows for example?