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
@nasir733
nasir733 / blurhashDataURL.ts
Created January 26, 2023 05:59 — forked from gxvxc/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) {