web-fs API Documentation - v1.0.0
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Properties

    type: "directory"

    ディレクトリハンドルの種類。常に"directory"を返します。

    Accessors

    • get name(): string

      ファイルハンドルの名前。ファイル名やディレクトリ名を表します。

      Returns string

    Methods

    • ファイルをWebFsFileHandleでラップしたものを返します。

      Parameters

      • handle: FileSystemDirectoryHandle

        すでに取得しているファイルハンドル。

      • mode: FileSystemPermissionMode = "read"

        ファイルのオプション。

      Returns Promise<WebFsDirectoryHandle | undefined>

      成功した場合はWebFsFileHandle、エラーが出た場合はundefined

    • ファイルを取得します。ファイル名またはファイルの相対パスを指定します。

      Parameters

      • filePath: string

        取得するファイルのファイルパス。

      • Optionaloptions: WebFsGetFileOptions

        ファイルのオプション。

      Returns Promise<WebFsFileHandle | undefined>

      ファイルが取得できた場合はWebFsFileHandleoptions.createfalseかつファイルが存在しない場合、またはエラーが出た場合はundefined

    • ディレクトリを取得します。ディレクトリ名またはディレクトリの相対パスで指定します。

      Parameters

      • dirPath: string

        取得するディレクトリのファイルパス。

      • Optionaloptions: WebFsGetDirectoryOptions

        ディレクトリのオプション。

      Returns Promise<WebFsDirectoryHandle | undefined>

      ディレクトリが取得できた場合はWebFsDirectoryHandleoptions.createfalseかつディレクトリが存在しない場合、またはエラーが出た場合はundefined

    • ファイルを簡易的なglobパターンから取得します。

      Parameters

      • pattern: string

      Returns Promise<WebFsFileHandle[]>

      globパターンにマッチしたファイルのWebFsFileHandleの配列。

    • ファイルまたはディレクトリを削除します。削除するエントリーがディレクトリであった場合は、その子孫を再帰的に削除します。

      Parameters

      • entryPath: string

        削除するファイルまたはディレクトリの名前。

      Returns Promise<boolean>

      削除に成功した場合はtrue、エントリーが存在しないまたはエラーの場合はfalse

    • 現在の階層にあるファイル名またはディレクトリ名の一覧を取得します。

      Parameters

      Returns Promise<string[]>

      ファイル名またはディレクトリ名からなる配列を返します。

    • ファイル構造を文字列のツリー形式として取得します。

      返り値の例:

      babel/
       ├─ code-frame/
       │  ├─ lib/
       │  ├─ LICENSE
       │  ├─ package.json
       │  └─ README.md
       ├─ compat-data/
       │  ├─ data/
       │  ├─ corejs3-shipped-proposals.js
       │  ├─ plugin-bugfixes.js
       │  ├─ corejs2-built-ins.js
       ...
      

      Parameters

      Returns Promise<string>

      ツリー形式の文字列。