Interface IBlobStorage

interface IBlobStorage {
    getBlobSize(sha256): number | Promise<number>;
    getBlobType(sha256): undefined | string | Promise<undefined | string>;
    hasBlob(sha256): Promise<boolean>;
    listBlobs(): Promise<string[]>;
    readBlob(sha256): Promise<Readable>;
    removeBlob(sha256): Promise<void>;
    setup(): Promise<void>;
    writeBlob(sha256, stream, type?): Promise<void>;
}

Implemented by

Methods

  • get the size of the stored blob

    Parameters

    • sha256: string

    Returns number | Promise<number>

  • get the MIME type of the blob if the storage knows it

    Parameters

    • sha256: string

    Returns undefined | string | Promise<undefined | string>

  • check if blob exists in storage

    Parameters

    • sha256: string

    Returns Promise<boolean>

  • returns the blob contents as a Readable stream

    Parameters

    • sha256: string

    Returns Promise<Readable>

  • remove a blob from storage

    Parameters

    • sha256: string

    Returns Promise<void>

  • save blob

    Parameters

    • sha256: string
    • stream: Readable | Buffer
    • Optional type: string

    Returns Promise<void>