import { createHash } from "node:crypto"; const hasher = createHash("sha256"); export const hashDigest = (payload: string | Buffer) => "sha-256=" + hasher .update((Buffer.isBuffer(payload) ? payload : Buffer.from(payload)).toString("hex")) .digest("base64"); export const streamToString = async (stream: ReadableStream) => { const arr = new Uint8Array(await new Response(stream).arrayBuffer()); return new TextDecoder("utf-8").decode(arr); };