Skip to content

ResourceStore

Defined in: src/core/ir/resources.ts:48

A content-addressed store for the IR’s binary payloads (images, fonts). IR trees stay pure JSON and reference bytes by ResourceId; ids derive from the bytes (a synchronous 64-bit FNV-1a), so identical payloads deduplicate for free and equal documents get equal ids — which keeps IR-level diffs and the byte-identical gates meaningful.

new ResourceStore(): ResourceStore

ResourceStore

get size(): number

Defined in: src/core/ir/resources.ts:85

The number of distinct resources stored.

number

get(id): Uint8Array<ArrayBufferLike> | undefined

Defined in: src/core/ir/resources.ts:70

Look up the bytes for an id, or undefined when absent.

ResourceId

Uint8Array<ArrayBufferLike> | undefined


has(id): boolean

Defined in: src/core/ir/resources.ts:75

Whether an id is present in the store.

ResourceId

boolean


ids(): readonly ResourceId[]

Defined in: src/core/ir/resources.ts:80

All stored ids, in insertion order.

readonly ResourceId[]


put(bytes): ResourceId

Defined in: src/core/ir/resources.ts:56

Store bytes and return their content-addressed id. Re-putting identical bytes returns the existing id (deduplication); a hash collision with different bytes probes deterministic ~n suffixes.

Uint8Array

ResourceId