1// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// https://wicg.github.io/native-file-system/#filesystemdirectoryhandle
6[
7    Exposed=(Window,Worker),
8    SecureContext,
9    Serializable,
10    RuntimeEnabled=NativeFileSystem,
11    ImplementedAs=NativeFileSystemDirectoryHandle
12] interface FileSystemDirectoryHandle : FileSystemHandle {
13    // TODO(https://crbug.com/1087157): This interface defines an async
14    // iterable, however that isn't supported yet by the bindings. So for now
15    // just explicitly define what an async iterable definition implies.
16    //async iterable<USVString, FileSystemHandle>;
17    NativeFileSystemDirectoryIterator entries();
18    NativeFileSystemDirectoryIterator keys();
19    NativeFileSystemDirectoryIterator values();
20
21    [CallWith=ScriptState] Promise<FileSystemFileHandle> getFileHandle(USVString name, optional FileSystemGetFileOptions options = {});
22    [CallWith=ScriptState] Promise<FileSystemDirectoryHandle> getDirectoryHandle(USVString name, optional FileSystemGetDirectoryOptions options = {});
23
24    [CallWith=ScriptState] Promise<void> removeEntry(USVString name, optional FileSystemRemoveOptions options = {});
25
26    [CallWith=ScriptState, Measure] Promise<sequence<USVString>?> resolve(FileSystemHandle possibleChild);
27};
28