diff --git a/EXPLAINER.md b/EXPLAINER.md index 09a3f9d..6d6514d 100644 --- a/EXPLAINER.md +++ b/EXPLAINER.md @@ -192,8 +192,12 @@ const file_ref = await dir_ref.getFile('foo.js'); // Get a subdirectory. const subdir = await dir_ref.getDirectory('bla', {createIfNotExists: true}); -// And you can possibly do stuff like move and/or copy files around. -await file_ref.copyTo(dir_ref, 'new_name', {overwrite: true}); +// No special API to create copies, but still possible to do so by using +// available read and write APIs. +const new_file = await dir_ref.getFile('new_name', {create: true}); +const new_file_writer = await new_file.createWriter(); +await new_file_writer.truncate(0); +await new_file_writer.write(0, await file_ref.getFile()); ``` You can also check if two references reference the same file or directory (or at diff --git a/index.bs b/index.bs index 753dcbb..c0dd0c5 100644 --- a/index.bs +++ b/index.bs @@ -74,11 +74,6 @@ interface FileSystemHandle { readonly attribute boolean isDirectory; readonly attribute USVString name; - Promise moveTo(USVString name); - Promise moveTo( - FileSystemDirectoryHandle parent, optional USVString name); - Promise copyTo( - FileSystemDirectoryHandle parent, optional USVString name); Promise remove(); Promise queryPermission(optional FileSystemHandlePermissionDescriptor descriptor); @@ -110,59 +105,6 @@ associated [=FileSystemHandle/entry=] is a [=directory entry=], and false otherw The name attribute must return the [=entry/name=] of the associated [=FileSystemHandle/entry=]. -### The {{FileSystemHandle/moveTo()}} method ### {#api-filesystemhandle-moveto} - -
- : |newHandle| = await |handle| . {{FileSystemHandle/moveTo()|moveTo}}(|newName|) - :: Renames the entry represented by |handle| to |newName|. - - : |newHandle| = await |handle| . {{FileSystemHandle/moveTo()|moveTo}}(|otherDir|) - :: Moves the entry represented by |handle| to |otherDir|, while keeping its existing name. - - : |newHandle| = await |handle| . {{FileSystemHandle/moveTo()|moveTo}}(|otherDir|, |newName|) - :: Moves the entry represented by |handle| to |otherDir|, while renaming it to |newName|. - - In all of these cases, |handle| will no longer represent a valid entry, and thus any further - operations on it will fail. - - Attempting to move an entry to the directory it already exists in, without renaming it is - an error. In all other cases if the target entry already exists, it is overwritten. -
- -
-The moveTo(|parent|, |name|) method, when invoked, must run -these steps: - -1. TODO - -
- -### The {{FileSystemHandle/copyTo()}} method ### {#api-filesystemhandle-copyto} - -
- : |newHandle| = await |handle| . {{FileSystemHandle/copyTo()|copyTo}}(|otherDir|) - :: Creates a copy of the entry represented by |handle| in |otherDir|, while keeping its existing - name. - - : |newHandle| = await |handle| . {{FileSystemHandle/copyTo()|copyTo}}(|otherDir|, |newName|) - :: Creates a copy of the entry represented by |handle| in |otherDir|, using |newName| for the - name of the new entry. - - In all of these cases, |handle| will no longer represent a valid entry, and thus any further - operations on it will fail. - - Attempting to copy an entry on top of itself will fail. In all other cases if the target entry - already exists, it is overwritten. -
- -
-The copyTo(|parent|, |name|) method, when invoked, must run -these steps: - -1. TODO - -
- ### The {{FileSystemHandle/remove()}} method ### {#api-filesystemhandle-remove}