-
Notifications
You must be signed in to change notification settings - Fork 66
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 FileSystemHandle::move() method #317
Conversation
Note that at this point the changes to the explainer are still very much WIP. |
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
@a-sully Could you please hash out an alternative where the API throws on non-atomic moves? I think it's worth discussing the benefits (no performance cliff, more flexibility in handling errors for the app, less complexity for browser implementers translating to less room for implementation-specific behavior) versus the costs (potential for errors not caught in development, apps need code to handle the cross-filesystem case). Also, we should discuss doing different things for moving files vs directories. Moving a large directory across the OPFS -> file system boundary means locking and possibly performing checks (Safe Browsing in Chrome) for an unbounded number of files. |
@pwnall I've updated the description to talk about the things you mentioned. To be clear, are you talking about throwing on all moves which we cannot guarantee to be atomic (moves to non-local filesystems) or only when we attempt said move and it fails? |
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explainer and spec changes LGTM, given the idea we're proposing.
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab
@tomayac Just created a launch bug: https://crbug.com/1249662 |
…temHandle::rename() methods, a=testonly Automatic update from web-platform-tests Add FileSystemHandle::move() and FileSystemHandle::rename() methods Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2984739 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Victor Costan <[email protected]> Reviewed-by: Marijn Kruisselbrink <[email protected]> Cr-Commit-Position: refs/heads/main@{#919810} -- wpt-commits: 72023078617ed82a4c707c7966fffe42b0f0e66a wpt-pr: 29686
…temHandle::rename() methods, a=testonly Automatic update from web-platform-tests Add FileSystemHandle::move() and FileSystemHandle::rename() methods Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2984739 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Victor Costan <[email protected]> Reviewed-by: Marijn Kruisselbrink <[email protected]> Cr-Commit-Position: refs/heads/main@{#919810} -- wpt-commits: 72023078617ed82a4c707c7966fffe42b0f0e66a wpt-pr: 29686
Hello @a-sully @pwnall @mikewest @mkruisselbrink @tomayac, is there any update on this? Can this be merged? |
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2984739 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Victor Costan <[email protected]> Reviewed-by: Marijn Kruisselbrink <[email protected]> Cr-Commit-Position: refs/heads/main@{#919810}
@a-sully
|
This is what's in the article:
What do you want to change? |
|
@tomayac we actually just landed a change which consolidates the |
@tomayac I updated my answer in light of the new api. There might be better ways to phrase it. |
Please see GoogleChrome/web.dev#7172 with these changes. |
--- nevermind --- Actually... if you check this comment revision history (I don't know how to get it back), I realize what I'm doing wrong... |
can you not move dirs with things in them? |
@hcldan it looks like there's been some miscommunication on our side. Due to all of the open questions regarding cross-file-system moves, @tomayac would you mind updating web.dev to reflect this? (see the launch bug.) We would like to support this feature more broadly eventually, but to do so we need to address the open questions mentioned in this PR. Apologies for the confusion. |
But both of these dirs are within the OPFS.. they aren't cross filesystem... Even those dir moves are disabled? |
Yes, directory moves within OPFS are (annoyingly) not atomic so those have been temporarily blocked, as well. |
How temporarily (how long)? |
Done: GoogleChrome/web.dev@0f2f161. |
@a-sully Thank you for this statement, but it brings up another question for me. |
@a-sully could you please rebase these commits against https://github.com/whatwg/fs and create a PR there? |
This issue has been ported to whatwg/fs#10 |
Currently, it is not possible to move or rename a file or directory without creating a new file/directory, copying over data (recursively, in the case of a directory), and removing the original. This CL allows for the atomic moving of a file or directory on the local file system without needing to duplicate data. Moves to non-local file systems will are not guaranteed to be atomic and will involve duplicating data. PR: WICG/file-system-access#317 Bug: 1140805 Change-Id: I774ed1d9616249b6ecc80783db48a7bfee915aab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2984739 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Victor Costan <[email protected]> Reviewed-by: Marijn Kruisselbrink <[email protected]> Cr-Commit-Position: refs/heads/main@{#919810} NOKEYCHECK=True GitOrigin-RevId: 89be8a84bf5c962fa363bd093f4f125ac923838c
See
MoveAndRename.md
Preview | Diff
Preview | Diff