Use Cases
Browser Uploader Flow
Generate placeholders in the browser when users upload images in client UI.
When to use
Section titled “When to use”Use this pattern when images are selected by users and should not be uploaded just to generate a placeholder.
Example
Section titled “Example”import { encode } from 'blurkit/browser'
async function handleFile(file: File) { const result = await encode(file, { algorithm: 'thumbhash', size: 32, })
return { blurDataURL: result.dataURL, blurHash: result.hash, width: result.meta.originalWidth, height: result.meta.originalHeight, }}Inputs / Options / Behavior
Section titled “Inputs / Options / Behavior”- Use
FileorBlobinput for local user images. metafields can be stored with upload payloads.thumbhashcan reduce payload size for very small placeholders.
Limits / Caveats
Section titled “Limits / Caveats”- Remote URL input requires CORS.
- Browser runtime cannot read local path strings.