import { createHash } from 'node:crypto'; import { readFileSync, statSync } from 'node:fs'; const path = process.argv[2]; if (!path) { console.error('Usage: node scripts/hash.mjs /absolute/or/relative/path/to/file.pdf'); process.exit(1); } const buf = readFileSync(path); const sha256 = createHash('sha256').update(buf).digest('hex'); const bytes = statSync(path).size; console.log(JSON.stringify({ sha256, bytes }, null, 2));