Runtime Guides
Browser Runtime
Encode placeholders from File, Blob, ArrayBuffer, or CORS-enabled remote URLs in client code.
When to use
Section titled “When to use”Use blurkit/browser when the user provides an image in the client and you need a local preview placeholder.
Example
Section titled “Example”import { encode } from 'blurkit/browser'
const input = document.querySelector<HTMLInputElement>('#image')const file = input?.files?.[0]
if (file) { const result = await encode(file, { algorithm: 'thumbhash', outputFormat: 'png', })
console.log(result.dataURL)}Inputs / Options / Behavior
Section titled “Inputs / Options / Behavior”- Supported inputs:
FileBlobArrayBufferUint8Array- remote URL string or
URLwhen CORS allows fetch and decode
- Includes
encodeMany()andencodeManySettled().
Limits / Caveats
Section titled “Limits / Caveats”- Local filesystem paths are not supported.
- Remote URL flow fails when CORS blocks image decode.