Skip to content

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

Open
@a-sully

Description

@a-sully

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds concrete proposalMoving the issue forward requires someone to figure out a detailed plan

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions