Setu-TS
    Preparing search index...

    Interface IFileSystem

    Runtime-agnostic file system operations. Absent on runtimes without file system access (edge platforms).

    0.1.0

    interface IFileSystem {
        mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;
        readdir(path: string): Promise<readonly string[]>;
        readFile(path: string): Promise<Uint8Array<ArrayBufferLike>>;
        readStream?(
            path: string,
            options?: { end?: number; start?: number },
        ): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
        realPath?(path: string): Promise<string>;
        rm(path: string, options?: { recursive?: boolean }): Promise<void>;
        stat(path: string): Promise<StatResult>;
        writeFile(path: string, data: Uint8Array): Promise<void>;
    }
    Index
    • Creates a directory.

      Parameters

      • path: string

        Directory path

      • Optionaloptions: { recursive?: boolean }

        Set recursive to create parents

      Returns Promise<void>

    • Lists directory entries.

      Parameters

      • path: string

        Directory path

      Returns Promise<readonly string[]>

      Entry names

    • Reads a file.

      Parameters

      • path: string

        File path

      Returns Promise<Uint8Array<ArrayBufferLike>>

      The file contents

    • Reads a file as a stream, optionally with byte range.

      Optional: absent on runtimes/adapters that do not support streaming reads. Callers MUST degrade gracefully when it is not provided (e.g. fall back to reading the entire file via readFile).

      The end offset is INCLUSIVE, matching both node:fs createReadStream and HTTP Range semantics.

      Parameters

      • path: string

        File path

      • Optionaloptions: { end?: number; start?: number }

        Optional byte range (both start and end are inclusive)

      Returns Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>

      A readable stream of bytes

      0.1.0

    • Resolves a path to its canonical absolute form, following symlinks.

      Optional: absent on runtimes/adapters that cannot canonicalize paths. Callers MUST degrade gracefully when it is not provided (e.g. fall back to lexical containment) — see the static-asset handler in the React Router plugin, which uses it for symlink-safe containment when available.

      Parameters

      • path: string

        File path

      Returns Promise<string>

      The canonical absolute path

    • Removes a file or directory.

      Parameters

      • path: string

        Path to remove

      • Optionaloptions: { recursive?: boolean }

        Set recursive to remove directories with contents

      Returns Promise<void>

    • Writes a file, creating it if absent.

      Parameters

      • path: string

        File path

      • data: Uint8Array

        Bytes to write

      Returns Promise<void>