API Reference
Manifest Helpers
Use createManifest() and writeManifest() to persist many BlurResult entries.
Manifest shape
Use manifest helpers when you precompute placeholders and need one stable JSON file for runtime lookup.
Create and write a manifest
import { encode } from 'blurkit/node'import { createManifest, writeManifest } from 'blurkit/node'
const result = await encode('./public/hero.jpg')const manifest = createManifest({ '/images/hero.jpg': result,})
await writeManifest('./blur-manifest.json', manifest, { pretty: true })Signatures and runtime support
createManifest(images: Record<string, BlurResult>): BlurManifestwriteManifest(filePath: string, manifest: BlurManifest, options?: { pretty?: boolean }): Promise<void>
interface BlurManifest { version: 1 algorithm?: 'blurhash' | 'thumbhash' | 'mixed' generatedAt: string images: Record<string, BlurResult>}createManifest()infersalgorithmas single value ormixed.writeManifest()creates parent directories and writes UTF-8 JSON.createManifest()has no filesystem dependency:blurkit/node,blurkit/deno, and the rootblurkitimport all export it. Theblurkit/browser,blurkit/edge,blurkit/cloudflare, andblurkit/wasmsubpaths do not re-export it, so import it from the root there.writeManifest()only writes files inblurkit/nodeandblurkit/deno; the browser and edge root exports expose it as a function that throws.- In browser or worker code, call
createManifest()and persist the JSON with your own storage layer (R2, KV, an API route, and so on).
Caveats
- Path key strategy is chosen by caller when creating
imagesmap. - Manifest helpers do not validate downstream URL conventions.