A container for interacting with a file system. Operations such as component resolution, conversion, and packaging perform I/O against TreeContainer abstractions.

Extend this base class to implement a custom container.

Hierarchy (view full)

Constructors

Methods

  • Whether or not a file path exists in the container.

    Parameters

    • fsPath: string

      File path to test

    Returns boolean

    true if the path exists

  • Searches for a metadata component file in a container directory.

    Parameters

    • fileType: "content" | "metadataXml"

      The type of component file

    • name: string

      The name of the file without a suffix

    • directory: string

      The directory to search in

    Returns undefined | string

    The first path that meets the criteria, or undefined if none were found

  • Whether or not a file path is a directory in the container.

    Parameters

    • fsPath: string

      File path to test

    Returns boolean

    true if the path is to a directory

  • Reads the contents of a directory in the container.

    Parameters

    • fsPath: string

      Path to directory

    Returns string[]

    An array of file and directory names in the directory

  • Reads the contents of a file.

    Parameters

    • fsPath: string

    Returns Promise<Buffer>

    A buffer of the file contents

  • Reads the contents of a file synchronously.

    Parameters

    • fsPath: string

    Returns Buffer

    A buffer of the file contents

  • Creates a readable stream of a file's contents.

    Parameters

    • fsPath: string

      File path to create a readable stream from

    Returns Readable

    A readable stream