Skip to content

Commit

Permalink
Update interfaces/native-file-system.idl
Browse files Browse the repository at this point in the history
  • Loading branch information
autofoolip committed Mar 23, 2020
1 parent a94e269 commit 5b39eb8
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions interfaces/native-file-system.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ interface FileSystemHandle {
readonly attribute boolean isDirectory;
readonly attribute USVString name;

Promise<boolean> isSameEntry(FileSystemHandle other);

Promise<PermissionState> queryPermission(optional FileSystemHandlePermissionDescriptor descriptor = {});
Promise<PermissionState> requestPermission(optional FileSystemHandlePermissionDescriptor descriptor = {});
};

dictionary FileSystemCreateWriterOptions {
dictionary FileSystemCreateWritableOptions {
boolean keepExistingData = false;
};

[Exposed=(Window,Worker), SecureContext, Serializable]
interface FileSystemFileHandle : FileSystemHandle {
Promise<File> getFile();
Promise<FileSystemWriter> createWriter(optional FileSystemCreateWriterOptions options = {});
Promise<FileSystemWritableFileStream> createWritable(optional FileSystemCreateWritableOptions options = {});
};

dictionary FileSystemGetFileOptions {
Expand All @@ -48,13 +50,30 @@ interface FileSystemDirectoryHandle : FileSystemHandle {
object getEntries();

Promise<void> removeEntry(USVString name, optional FileSystemRemoveOptions options = {});

Promise<sequence<USVString>?> 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<void> write(unsigned long long position, (BufferSource or Blob or USVString) data);
interface FileSystemWritableFileStream : WritableStream {
Promise<void> write(FileSystemWriteChunkType data);
Promise<void> seek(unsigned long long position);
Promise<void> truncate(unsigned long long size);
Promise<void> close();
};

enum ChooseFileSystemEntriesType { "open-file", "save-file", "open-directory" };
Expand Down

0 comments on commit 5b39eb8

Please sign in to comment.