Beignet API reference
    Preparing search index...

    App-facing object storage port.

    Implement this with S3, R2, local disk, or a test adapter. Application code should depend on this interface instead of provider-specific SDKs.

    interface StoragePort {
        delete(key: string): Promise<boolean>;
        exists(key: string): Promise<boolean>;
        get(key: string): Promise<StorageObjectBody | null>;
        publicUrl(key: string): Promise<string | null>;
        put(
            key: string,
            body: StorageBody,
            options?: StoragePutOptions,
        ): Promise<StorageObject>;
        stat(key: string): Promise<StorageObject | null>;
    }
    Index

    Methods

    • Delete an object.

      Parameters

      • key: string

      Returns Promise<boolean>

      true when the object existed.

    • Return whether an object exists.

      Parameters

      • key: string

      Returns Promise<boolean>

    • Return object metadata and body, or null when missing.

      Parameters

      • key: string

      Returns Promise<StorageObjectBody | null>

    • Return a public URL when the object is public and the adapter can build one.

      Parameters

      • key: string

      Returns Promise<string | null>

    • Return object metadata without its body, or null when missing.

      Parameters

      • key: string

      Returns Promise<StorageObject | null>