server/fact_write.ts view source
(fact_store: FactStore, embedded_threshold: number, facts_dir: string, bytes: Uint8Array<ArrayBufferLike>, options: WriteFactOptions): Promise<...> import {write_fact} from '@fuzdev/fuz_app/server/fact_write.js'; Write bytes as a fact, choosing embedded (PG) vs external (disk +
put_ref) based on embedded_threshold. Returns the canonical
blake3: hash either way.
fact_store
the FactStore (typically PgFactStore)
FactStoreembedded_threshold
bytes ≤ threshold → embedded; > threshold → disk
numberfacts_dir
root of the sharded facts directory tree on disk
stringbytes
the raw fact bytes
Uint8Array<ArrayBufferLike>options
content type for the fact metadata
returns
Promise<string & $brand<"FactHash">> the fact's blake3:<hex64> hash