← @mortar-kit/core

BlobStoreinterface

import { BlobStore } from '@mortar-kit/core'

interface BlobStore

Where uploaded files live: bytes by key. Implement it to keep files anywhere (a folder, S3, a CDN). Deliberately dumb; createContent checks types, sizes and keys, and refuses to delete a file documents use.

Properties

list: () => Promise<BlobInfo[]>

Every stored file. [] if none.

get: (key: string) => Promise<Blob | undefined>

The file under key (its type set from the key's extension), or undefined.

put: (key: string, data: Blob) => Promise<void>

Stores data under key, replacing any file there.

remove: (key: string) => Promise<void>

Removes the file under key; nothing happens if there is none.

url: (key: string) => string

The URL the site loads the file from, e.g. /uploads/<key> or a bucket URL. Synchronous: it is computed, never looked up.