Skip to content

Runtime Guides

Node Runtime

Use sharp-backed encoding for local paths, remote URLs, batching, cache, and manifests.

Use blurkit/node for build steps, CMS import jobs, server-side processing, and manifest generation.

import { createFilesystemCache, encode } from 'blurkit/node'
const cache = createFilesystemCache({
dir: './.cache/blurkit',
ttlMs: 300_000,
})
const result = await encode('./public/hero.jpg', {
size: 32,
cache,
})
  • Supported inputs:
    • local path string
    • remote http/https URL string
    • URL
    • Blob
    • ArrayBuffer
    • Uint8Array (Node Buffer works directly, including views with a non-zero byte offset)
  • Requires sharp >=0.34.5 <0.36.0 at execution time.
  • Additional Node exports:
    • encodeMany()
    • encodeManySettled()
    • createMemoryCache()
    • createFilesystemCache()
    • createManifest()
    • writeManifest()
  • Requires sharp.
  • Missing sharp throws BLURKIT_MISSING_SHARP with install guidance.
  • encodeMany() is fail-fast.