Runtime Guides
Edge Runtime
Encode placeholders in worker-style runtimes with native decode first and wasm fallback.
When to use
Section titled “When to use”Use blurkit/edge for worker-style runtimes when you want one entrypoint that prefers native decode APIs and falls back to wasm when they are missing.
Example
Section titled “Example”import { encode } from 'blurkit/edge'
const result = await encode('https://example.com/image.jpg')Inputs / Options / Behavior
Section titled “Inputs / Options / Behavior”- Supported inputs:
- remote
http/httpsURL string URLBlobArrayBufferUint8Array
- remote
- Includes
encodeMany()andencodeManySettled(). - Runtime selection:
- native path:
ImageDecoder+OffscreenCanvas - fallback path: wasm runtime (PNG/JPEG/WebP decode)
- native path:
- Fallback path requires
blurkit-wasm-codecsto be installed.
Limits / Caveats
Section titled “Limits / Caveats”- Non-remote string input is rejected.
- If native APIs are missing, edge automatically tries wasm fallback.
- If fallback codecs are missing, edge throws
BLURKIT_MISSING_WASM_CODECS. - If fallback fails for other reasons, error message includes both native and fallback guidance.
- For Cloudflare Workers, prefer
blurkit/cloudflare.