Fake Mirrors
    Preparing search index...

    Interface Storage

    Defines the public contract for a storage.

    Provides methods for basic S3-compatible storage operations: get, put, and delete.

    interface Storage {
        deleteObject(objectName: string): Promise<void>;
        ensureBucketExists(): Promise<void>;
        getObject(objectName: string): Promise<Buffer<ArrayBufferLike>>;
        putObject(
            objectName: string,
            data: Buffer,
            headers: Record<string, string>,
        ): Promise<void>;
    }

    Implemented by

    • Deletes an object from the storage.

      Parameters

      • objectName: string

        The path of the object to delete.

      Returns Promise<void>

      StorageError If the object cannot be deleted.

    • Ensures that the configured bucket exists.

      This method is typically called during application startup to verify that the storage bucket is accessible. If the bucket does not exist, a bootstrap error is thrown.

      Returns Promise<void>

      BootstrapError If the bucket does not exist or is inaccessible.

    • Retrieves an object from the storage.

      Parameters

      • objectName: string

        The path of the object to retrieve.

      Returns Promise<Buffer<ArrayBufferLike>>

      The object content as a Buffer.

      StorageError If the object cannot be retrieved.

    • Stores an object in the storage.

      Parameters

      • objectName: string

        The path to assign to the object.

      • data: Buffer

        The object content as a Buffer.

      • headers: Record<string, string>

        Custom headers to attach to the object.

      Returns Promise<void>

      StorageError If the object cannot be stored.