fs.idl (2973B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: File System Standard (https://fs.spec.whatwg.org/) 5 6 enum FileSystemHandleKind { 7 "file", 8 "directory", 9 }; 10 11 [Exposed=(Window,Worker), SecureContext, Serializable] 12 interface FileSystemHandle { 13 readonly attribute FileSystemHandleKind kind; 14 readonly attribute USVString name; 15 16 Promise<boolean> isSameEntry(FileSystemHandle other); 17 }; 18 19 dictionary FileSystemCreateWritableOptions { 20 boolean keepExistingData = false; 21 }; 22 23 [Exposed=(Window,Worker), SecureContext, Serializable] 24 interface FileSystemFileHandle : FileSystemHandle { 25 Promise<File> getFile(); 26 Promise<FileSystemWritableFileStream> createWritable(optional FileSystemCreateWritableOptions options = {}); 27 [Exposed=DedicatedWorker] 28 Promise<FileSystemSyncAccessHandle> createSyncAccessHandle(); 29 }; 30 31 dictionary FileSystemGetFileOptions { 32 boolean create = false; 33 }; 34 35 dictionary FileSystemGetDirectoryOptions { 36 boolean create = false; 37 }; 38 39 dictionary FileSystemRemoveOptions { 40 boolean recursive = false; 41 }; 42 43 [Exposed=(Window,Worker), SecureContext, Serializable] 44 interface FileSystemDirectoryHandle : FileSystemHandle { 45 async_iterable<USVString, FileSystemHandle>; 46 47 Promise<FileSystemFileHandle> getFileHandle(USVString name, optional FileSystemGetFileOptions options = {}); 48 Promise<FileSystemDirectoryHandle> getDirectoryHandle(USVString name, optional FileSystemGetDirectoryOptions options = {}); 49 50 Promise<undefined> removeEntry(USVString name, optional FileSystemRemoveOptions options = {}); 51 52 Promise<sequence<USVString>?> resolve(FileSystemHandle possibleDescendant); 53 }; 54 55 enum WriteCommandType { 56 "write", 57 "seek", 58 "truncate", 59 }; 60 61 dictionary WriteParams { 62 required WriteCommandType type; 63 unsigned long long? size; 64 unsigned long long? position; 65 (BufferSource or Blob or USVString)? data; 66 }; 67 68 typedef (BufferSource or Blob or USVString or WriteParams) FileSystemWriteChunkType; 69 70 [Exposed=(Window,Worker), SecureContext] 71 interface FileSystemWritableFileStream : WritableStream { 72 Promise<undefined> write(FileSystemWriteChunkType data); 73 Promise<undefined> seek(unsigned long long position); 74 Promise<undefined> truncate(unsigned long long size); 75 }; 76 77 dictionary FileSystemReadWriteOptions { 78 [EnforceRange] unsigned long long at; 79 }; 80 81 [Exposed=DedicatedWorker, SecureContext] 82 interface FileSystemSyncAccessHandle { 83 unsigned long long read(AllowSharedBufferSource buffer, 84 optional FileSystemReadWriteOptions options = {}); 85 unsigned long long write(AllowSharedBufferSource buffer, 86 optional FileSystemReadWriteOptions options = {}); 87 88 undefined truncate([EnforceRange] unsigned long long newSize); 89 unsigned long long getSize(); 90 undefined flush(); 91 undefined close(); 92 }; 93 94 [SecureContext] 95 partial interface StorageManager { 96 Promise<FileSystemDirectoryHandle> getDirectory(); 97 };