safeLex

tcmts.registry.safeLex · #sassnim3 · term · runs anywhere

An archive record's DAG-CBOR, as data (undefined if it isn't any).

import { parseRawRecord } from "@bsky/jetstream";

export function safeLex(raw: Uint8Array): unknown {
  try {
    return parseRawRecord(raw);
  } catch {
    return undefined;
  }
}

used by