digestOf
uses node:crypto
A file's SHA-256, as Available-Dictionary names a dictionary (base64).
import { assetDigests } from "#codebase/tcmts/cli/web"; import { createHash } from "node:crypto"; import fs from "node:fs"; export function digestOf(file: string): string { let d = assetDigests.get(file); if (!d) assetDigests.set( file, (d = createHash("sha256").update(fs.readFileSync(file)).digest("base64")), ); return d; }