import { createHash } from "node:crypto"; export const MAX_DOCUMENT_BYTES: number = 8 * 1024 * 1024; export function digest(value: string): string { return createHash("sha256").update(value).digest("hex"); } export function cleanText(value: string): string { return value .replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "") .replace(/.\x08/g, "") .replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g, ""); }