Interface FileIO

An interface for file input/output operations that can be implemented for different environments such as Node.js or the browser.

interface FileIO {
    load(url: string): Promise<CrossPlatformBlob | Buffer>;
    save(data: CrossPlatformBlob | Buffer, target: string): Promise<void>;
}

Implemented by

Methods

Methods

  • Loads file data from a given URL or path.

    Parameters

    • url: string

      The source URL or file path to load from.

    Returns Promise<CrossPlatformBlob | Buffer>

    A promise that resolves to either a Node.js Buffer or a CrossPlatformBlob, depending on the environment.

  • Saves data to a specified target location.

    Parameters

    • data: CrossPlatformBlob | Buffer

      The data to save, which can be a Buffer or a CrossPlatformBlob.

    • target: string

      The destination path or identifier where the data should be saved.

    Returns Promise<void>

    A promise that resolves when the save operation is complete.