Overview

Documentation

Technical reference for blurkit runtimes, API behavior, CLI usage, and production patterns.

On this page

One encode, end to end

scripts/encode-hero.ts
import { encode } from 'blurkit/node'
const result = await encode('./public/hero.jpg', {
algorithm: 'blurhash',
size: 32,
})
console.log(result.dataURL)

encode() decodes the input, resizes it to the target dimensions, hashes it, and renders the hash back to an image data URL. The same call shape works on every runtime; only the entrypoint and its input forms change.

What comes back

  • dataURL — the placeholder to pass to an image src or blurDataURL.
  • hash — the BlurHash or ThumbHash string for storage and later decoding.
  • width / height — the dimensions of the encoded image.
  • meta — source dimensions and, when the decoder reports them, format and alpha.

See API: Result for the full contract, including the Cloudflare exception.

How the package is organized

  • Explicit entrypoints: blurkit/node, blurkit/deno, blurkit/browser, blurkit/edge, blurkit/cloudflare, blurkit/wasm.
  • The root blurkit import resolves through export conditions (node, browser, worker, deno) rather than a runtime switch.
  • encodeMany() fails fast; encodeManySettled() returns per-item envelopes.
  • The CLI, manifest helpers, and cache helpers cover build steps and repeated work.

Start here

  • Installation — dependency rules and the canonical runtime matrix.
  • Quick Start — first successful encode.
  • Runtime guides — pick the entrypoint that matches your platform.
  • API reference — encode(), options, result, cache, manifests.
  • Guides — Next.js, browser uploads, build-time manifests, CMS imports.

Minimal integrations live in the repository: