Skip to content

API Reference

Manifest Helpers

Use createManifest() and writeManifest() to persist many BlurResult entries.

Use manifest helpers when you precompute placeholders and need one stable JSON file for runtime lookup.

import { createManifest, writeManifest } from 'blurkit'
const manifest = createManifest({
'/images/hero.jpg': result,
})
await writeManifest('./blur-manifest.json', manifest, { pretty: true })
createManifest(images: Record<string, BlurResult>): BlurManifest
writeManifest(filePath: string, manifest: BlurManifest, options?: { pretty?: boolean }): Promise<void>
interface BlurManifest {
version: 1
algorithm?: 'blurhash' | 'thumbhash' | 'mixed'
generatedAt: string
images: Record<string, BlurResult>
}
  • createManifest() infers algorithm as single value or mixed.
  • writeManifest() creates parent directories and writes UTF-8 JSON.
  • Path key strategy is chosen by caller when creating images map.
  • Manifest helpers do not validate downstream URL conventions.