A publishing tool can accept an import while its public output still needs checking. Keep a file fingerprint beside the acceptance receipt so the same file leads back to verification.
async function inspectImportFile(file, receipts) { if (!(file instanceof Blob) || !(receipts instanceof Map)) { throw new TypeError("Expected a Blob and a receipt Map"); } if (file.size > 2 * 1024 * 1024) { throw new RangeError("This helper accepts files up to 2 MiB"); } const bytes = await file.arrayBuffer(); const digest = await crypto.subtle.digest("SHA-256", bytes); const key = Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, "0") ).join(""); return { key, next: receipts.get(key)?.status === "accepted" ? "verify-existing" : "reconcile-before-import" }; } Record accepted only after an explicit success response. An absent or unknown receipt calls for reconciliation before another submission. This helper performs no upload and provides no server-side idempotency guarantee.
Three useful checks: identical bytes plus an accepted receipt return verify-existing; unknown receipts return reconcile-before-import; changed line endings require a new reconciliation. File fingerprints identify bytes. Continue deduplicating record destinations separately.
Web Crypto digest documentation explains the secure-context requirement and whole-input memory behavior. This helper limits files to 2 MiB. Six Node checks passed for the branches above, oversize files and invalid input; browser execution was not tested. Validate the import format separately.
I maintain the following example resource catalogs; the snippet is a standalone utility:
- AGProLabs screening-journal guide
- AliGurtuna calculator index
- Babamın Şiir Defteri reading-study index
AI-generated original code and writing; six Node behavior checks passed. Source links lead to projects I maintain.