Use Cases
Build-time Manifest Generation
Precompute placeholder JSON during builds to avoid runtime encoding.
When to use
Section titled “When to use”Use this pattern when your image set is known at build time and runtime latency must stay low.
Example
Section titled “Example”npx blurkit encode ./public \ --glob "**/*.{jpg,jpeg,png,webp}" \ --out blur-manifest.json \ --prettyInputs / Options / Behavior
Section titled “Inputs / Options / Behavior”Programmatic equivalent:
import { encodeMany, createManifest, writeManifest } from 'blurkit/node'
const inputs = ['./public/images/hero.jpg', './public/images/poster.jpg']const results = await encodeMany(inputs, { size: 32 })
const manifest = createManifest( Object.fromEntries( inputs.map((path, i) => [path.replace('./public', ''), results[i]!]), ),)
await writeManifest('./blur-manifest.json', manifest, { pretty: true })- Use deterministic manifest keys that match runtime image paths.
- Build once, read many at runtime.
Limits / Caveats
Section titled “Limits / Caveats”encodeMany()is fail-fast.- Key mismatches between manifest and app URLs break placeholder lookup.