Crumbtrail
    Preparing search index...

    A stream that can read and write to files.

    This is mostly a wrapper to readFile and writeFile from node, but with some optimizations.

    First, this class supports file content caching so reading in a file that's under a certain size threshold will store it in memory for later retrieval.

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    options: IZStreamFileOptions = {}

    The options for file read and writes.

    Methods

    • Reads from the given path.

      Parameters

      • path: PathLike

        The path to read from.

      • Optionaloptions: IZStreamReadOptions

        Options for the read.

      Returns Promise<Buffer<ArrayBufferLike>>

      The buffered data from the path.

      If the path does not exist or cannot be read.

    • Writes to a given path.

      Parameters

      • path: PathLike

        The path to write to. If this points to a hierarchy, then all hierarchy nodes should be created.

      • options: IZStreamWriteOptions = {}

        The options for the write.

      Returns Promise<number>

      The total number of bytes written, or 0 if buffer is falsy. If this is writing or creating directories, then 0 should be returned.

      If the path cannot be written to.