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

A `File` needs a pointer back to its `FileSystemHandle` #148

Open
tomayac opened this issue Jan 22, 2020 · 2 comments
Open

A `File` needs a pointer back to its `FileSystemHandle` #148

tomayac opened this issue Jan 22, 2020 · 2 comments

Comments

@tomayac
Copy link

@tomayac tomayac commented Jan 22, 2020

For the File resulting from a call to await fileHandle.getFile(), there's no way back to the FileSystemHandle, forcing library authors to store the handle somewhere. It would be nice if File had a readonly handle attribute that would allow for intuitive open-edit-save flows. I realize this is more of a File API issue, but since FileSystemHandle is spec'ed here, I start the discussion here.

@mkruisselbrink

This comment has been minimized.

Copy link
Contributor

@mkruisselbrink mkruisselbrink commented Jan 22, 2020

I'm curious to understand more of what you're trying to do here. In general I wouldn't expect anybody to ever hold on to the File object long-term (or call getFile() pre-emptively). File objects are conceptually snapshots, every time you save to the file (or otherwise modify the file on disk) you'll have to call getFile() again to get a new valid File object.

@tomayac

This comment has been minimized.

Copy link
Author

@tomayac tomayac commented Jan 23, 2020

Note that this is not about holding on to the File object itself, but indeed to store a reference to a File's FileSystemHandle so that eventually one can write back to it. Here's a deep link. The idea is to have the file opening code (with a fallback to <input type="file">) in one module, and as a common denominator return Files objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.