← @mortar-kit/core

serveBlobfunction

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

function serveBlob(store: BlobStore, key: string, request?: Request): Promise<Response>

A response serving one stored file: for an app route or middleware such as /uploads/*. Types come from the key's extension and are sent with nosniff, so a file can't be read as anything else; keys never change content, so files are cached for good. Answers byte ranges (video seeking) and 404 for an invalid key or a missing file.

Parameters

store: BlobStore
key: string
request?: Request

Returns

Promise<Response>