diff --git a/interfaces/native-file-system.idl b/interfaces/native-file-system.idl index f4679175c46ec78..b89b7871427331b 100644 --- a/interfaces/native-file-system.idl +++ b/interfaces/native-file-system.idl @@ -13,18 +13,20 @@ interface FileSystemHandle { readonly attribute boolean isDirectory; readonly attribute USVString name; + Promise isSameEntry(FileSystemHandle other); + Promise queryPermission(optional FileSystemHandlePermissionDescriptor descriptor = {}); Promise requestPermission(optional FileSystemHandlePermissionDescriptor descriptor = {}); }; -dictionary FileSystemCreateWriterOptions { +dictionary FileSystemCreateWritableOptions { boolean keepExistingData = false; }; [Exposed=(Window,Worker), SecureContext, Serializable] interface FileSystemFileHandle : FileSystemHandle { Promise getFile(); - Promise createWriter(optional FileSystemCreateWriterOptions options = {}); + Promise createWritable(optional FileSystemCreateWritableOptions options = {}); }; dictionary FileSystemGetFileOptions { @@ -48,13 +50,30 @@ interface FileSystemDirectoryHandle : FileSystemHandle { object getEntries(); Promise removeEntry(USVString name, optional FileSystemRemoveOptions options = {}); + + Promise?> resolve(FileSystemHandle possibleDescendant); +}; + +enum WriteCommandType { + "write", + "seek", + "truncate", }; +dictionary WriteParams { + required WriteCommandType type; + unsigned long long? size; + unsigned long long? position; + (BufferSource or Blob or USVString)? data; +}; + +typedef (BufferSource or Blob or USVString or WriteParams) FileSystemWriteChunkType; + [Exposed=(Window,Worker), SecureContext] -interface FileSystemWriter { - Promise write(unsigned long long position, (BufferSource or Blob or USVString) data); +interface FileSystemWritableFileStream : WritableStream { + Promise write(FileSystemWriteChunkType data); + Promise seek(unsigned long long position); Promise truncate(unsigned long long size); - Promise close(); }; enum ChooseFileSystemEntriesType { "open-file", "save-file", "open-directory" };