Skip to content

blurkit generates compact placeholder images using BlurHash or ThumbHash so you never ship a layout without knowing image dimensions. It runs on Node, Deno, the browser, edge workers, and Cloudflare — one API, no platform lock-in.

scripts/encode-hero.ts
import { encode } from 'blurkit/node'
const result = await encode('./public/hero.jpg', {
algorithm: 'blurhash',
size: 32,
})
console.log(result.dataURL)
  • blurkit ships explicit runtime entrypoints: blurkit/node, blurkit/deno, blurkit/browser, blurkit/edge, blurkit/cloudflare, and blurkit/wasm.
  • Root import blurkit resolves by export conditions (node, browser, worker) without runtime dynamic dispatch.
  • Successful encode() returns dataURL, hash, algorithm, width, height, and meta.
  • encodeMany() is fail-fast.
  • encodeManySettled() returns per-item success/failure results.
  • Node runtime requires sharp.
  • Deno runtime requires blurkit-wasm-codecs and uses wasm-backed decode with canvas render.
  • Browser runtime cannot read local filesystem paths.
  • Edge runtime uses native decode APIs when available, then falls back to wasm.
  • Cloudflare runtime accepts remote URL input only.
  • WASM runtime decode support is PNG/JPEG/WebP.
  • Remote URL input depends on network reachability and, in browsers, CORS.