chromium/third_party/blink/renderer/modules/file_system_access/file_system_file_handle.idl

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://fs.spec.whatwg.org/#filesystemfilehandle
[
    Exposed=(Window,Worker),
    SecureContext,
    Serializable,
    RuntimeEnabled=FileSystemAccess
] interface FileSystemFileHandle : FileSystemHandle {
    [
        CallWith=ScriptState,
        RaisesException,
        Measure
    ] Promise<FileSystemWritableFileStream> createWritable(
        optional FileSystemCreateWritableOptions options = {});

    [
        CallWith=ScriptState,
        RaisesException,
        Measure
    ] Promise<File> getFile();

    // TODO(crbug/1382215): Combine createSyncAccessHandle overloads into one
    // with options as an optional param that defaults to {}.
    [
        CallWith=ScriptState,
        RaisesException,
        Measure,
        Exposed=DedicatedWorker
    ] Promise<FileSystemSyncAccessHandle> createSyncAccessHandle();

    [
        CallWith=ScriptState,
        RaisesException,
        Measure,
        Exposed=DedicatedWorker,
        RuntimeEnabled=FileSystemAccessLockingScheme
    ] Promise<FileSystemSyncAccessHandle> createSyncAccessHandle(
      FileSystemCreateSyncAccessHandleOptions options);

    [
        CallWith=ScriptState,
        RaisesException,
        MeasureAs=FileSystemAccessMoveRename
    ]  Promise<undefined> move(USVString new_entry_name);
    [
        CallWith=ScriptState,
        RaisesException,
        MeasureAs=FileSystemAccessMoveReparent
    ]  Promise<undefined> move(FileSystemDirectoryHandle destination_directory);
    [
        CallWith=ScriptState,
        RaisesException,
        MeasureAs=FileSystemAccessMoveReparentAndRename
    ]  Promise<undefined> move(FileSystemDirectoryHandle destination_directory,
                          USVString new_entry_name);
};