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

Add a FileSystemHandle.create() method to create self #126

Open
a-sully opened this issue Jun 6, 2023 · 0 comments
Open

Add a FileSystemHandle.create() method to create self #126

a-sully opened this issue Jun 6, 2023 · 0 comments
Labels
addition/proposal New features or enhancements needs concrete proposal Moving the issue forward requires someone to figure out a detailed plan

Comments

@a-sully
Copy link
Collaborator

a-sully commented Jun 6, 2023

This idea has been discussed previously by both myself (#39 (comment)) and @szewai (#59 (comment))

#96 clarified that a FileSystemHandle maps to a file path - and therefore if the underlying file is removed, the FileSystemHandle itself is not changed (clarifying #39). Given the recent (though #9 is still blocked) addition of a remove() method (to remove self), it seems reasonable to allow "create self"

Currently, "create self" is possible on Chromium browsers via the createWritable() method due to an implementation quirk. See #125 for more details. An explicit create() method would allow for more common-sense behavior of the createWritable() method without removing a capability (i.e. "create self" - specifically when the parent directory is not accessible) that some use cases may rely on.

The specific shape of this API still needs more thought (e.g. it would be nice if this could play nicely with an exists() method, as proposed in #80, such that the "create if not exists" use case is less vulnerable to TOCTOU errors) but putting this out there in case anyone has comments or wants to put forward a proposal :)

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 concrete proposal Moving the issue forward requires someone to figure out a detailed plan
Development

No branches or pull requests

1 participant