Skip to content

Instantly share code, notes, and snippets.

View nasir733's full-sized avatar
:octocat:
Working from home

Nasir Iqbal nasir733

:octocat:
Working from home
View GitHub Profile
@gxvxc
gxvxc / blurhashDataURL.ts
Last active June 16, 2024 08:59 — forked from mattiaz9/blurhashDataURL.ts
Convert blurhash to a base64 DataURL string (no canvas or node-canvas)
import { decode } from "blurhash"
const cache: Record<string, string> = {}
export function blurHashToDataURL(hash: string | undefined): string | undefined {
if (!hash) return undefined
const cachedBlurDataURL = cache[hash]
if(cachedBlurDataURL) {