OptionalautoCompress?: booleanOptionalbz2?: Bzip2Injected bz2 module; never imported by the library.
Optionaldata?: Uint8Array<ArrayBufferLike>Sender-side payload.
OptionalisRequest?: booleanThis Resource is a REQUEST body.
OptionalisResponse?: booleanThis Resource is a RESPONSE body.
Optionallink?: LinkOptionalmetadata?: anySender-side response metadata (§10.4
x flag). Encoded as msgpack and prepended to the payload as
3-byte BE size ‖ packed metadata before hashing/compression, matching
the reference implementation's file-with-metadata transfers. Receivers
expose the decoded value as Resource.metadata and strip it from
Resource.data.
OptionaloriginalHash?: Uint8Array<ArrayBufferLike>OptionalrequestId?: Uint8Array<ArrayBufferLike>Associated REQUEST id (§11).
Whether any part request has arrived (sender) — adv vs transfer stall.
Whether sender preparation is done.
Epoch ms the current segment's advertisement was (re)sent (sender).
Consecutive fast windows observed (escalates the ceiling).
Epoch ms of the last transfer activity in either direction.
Response metadata: the decoded value on the receiver (after assembly), or the caller-supplied value on the sender.
Sender-side 3-byte BE size ‖ msgpack(metadata) prefix (§10.4). The
prefix is part of the hashed/compressed/encrypted blob on the wire.
Outstanding part requests in the current window (receiver).
Epoch ms the current window's RESOURCE_REQ went out.
Part bytes received within the current window.
Retries left before the watchdog cancels a stalled transfer.
Consecutive very-slow windows observed (drops the ceiling).
Receiver request window during a transfer.
How far the window may drift above the floor before the floor creeps.
Ceiling the request window grows toward (fast links earn the large one).
Floor the request window shrinks to under losses.
StaticDEFAULT_Absolute cap on the advertised part count n at accept time. Defends
against a single RESOURCE_ADV that advertises a tiny t but a huge n:
the receiver allocates new Array(n).fill(null) for the parts, so an
unbounded n is a one-packet OOM. Set generously enough that any
legitimate transfer up to DEFAULT_MAX_SIZE at the minimum MTU
(219 → sdu 183 → ~183k parts for 32 MiB) still fits, with headroom.
StaticDEFAULT_Sanity ceiling on an advertised total segment count l.
StaticDEFAULT_Cap on advertised transfer/logical size at accept time (§10.4 bomb defense).
StaticDEFAULT_Ceiling on the reassembled logical size of a split Resource — the
per-segment t/d caps bound each transfer, this bounds their sum.
StaticFAST_Consecutive fast windows before the ceiling escalates to fast.
StaticHASHMAP_Collision-guard span uses the slow-link window cap (§10.10).
StaticHEADER_RNS.Packet.HEADER_MAXSIZE — worst-case header after relay HEADER_1→HEADER_2
conversion: flags(1) + hops(1) + transport_id(16) + dest_hash(16) + context(1).
StaticIFAC_RNS.Reticulum.IFAC_MIN_SIZE — reserved IFAC bytes when computing SDU.
StaticMAX_Logical bytes per Resource segment (§10.3). Larger payloads are split
into l sequentially-advertised segments tied together by the first
segment's hash (o). Segment 1 counts the metadata prefix toward its
budget, so its payload share is smaller by the prefix length.
StaticMAX_Watchdog constants mirroring the Python reference's Resource
(MAX_RETRIES, PART_TIMEOUT_FACTOR, PER_RETRY_DELAY,
SENDER_GRACE_TIME, PROCESSING_GRACE, RETRY_GRACE_TIME,
PROOF_TIMEOUT_FACTOR). The JS watchdog ticks from the link's 1 Hz
watchdog instead of a per-resource thread; the semantics — bounded
stalls, bounded retries, then a failing cancel that drops the transfer
buffers — are the same.
StaticMETADATA_Max encodable metadata size: 3-byte length prefix limits it to 16 MiB-1.
StaticPART_Multiplier on the expected part-transfer time before a receiver retry.
StaticPER_Extra per-retry wait (seconds), applied cumulatively (receiver).
StaticPROCESSING_Grace over the advertisement timeout (seconds).
StaticPROOF_Multiplier on RTT when waiting for the final proof (vs a full req/resp).
StaticRANDOM_Size of the throwaway random prefix prepended to the wire body (§10.2
step 3). Distinct from the advertisement r field.
StaticRATE_Window rate (bytes/s) considered fast enough for the large window.
StaticRATE_Window rate (bytes/s) considered very slow.
StaticRETRY_Grace over the part-stall timeout (seconds).
StaticSENDER_Sender grace over the whole request window (seconds).
StaticVERY_Consecutive very-slow windows before the ceiling drops to very slow.
StaticWINDOWInitial receiver request window (§10.10).
StaticWINDOW_How far the window may drift above the floor before the floor creeps.
StaticWINDOW_Request-window ceiling on fast links (§10.10).
StaticWINDOW_Request-window ceiling on slow links (§10.10).
StaticWINDOW_Request-window ceiling on very slow links (§10.10).
StaticWINDOW_Floor the request window shrinks to under losses (§10.10).
Collision-guard span (§10.2 step 7): map_hashes must be unique within this many parts of any position.
Number of 4-byte map_hashes that fit in one advertisement's m field
(§10.4): floor((link.mdu - 134) / 4). At the default MDU 431 this is 74.
Maximum part body size. Parts are raw slices of the already-encrypted
whole, sent as context=RESOURCE packets which are NOT token-encrypted
(§10.6 gotcha), so the full SDU is available for part data.
Internal
Called by the link when it transitions to CLOSED: the transfer can never complete, so the resource fails and drops its transfer buffers. Without this a torn-down link is retained by its own resource maps, and the buffers (encrypted payload slices on the sender, accumulated received parts on the receiver) leak for the lifetime of the object — which compounds into multi-GB heap growth when links fail in a storm (the lille-oe OOM of 2026-10-17).
Optionalreason: string = "Link closed"Internal
One watchdog step, driven by the owning link's 1 Hz watchdog tick while
the transfer is registered on it (Python Resource.__watchdog_job
parity — there it runs as a per-resource thread instead).
Sender side: an advertisement nobody requested is retried a bounded
number of times, then cancelled; a transfer whose part requests dried up
is cancelled after the whole retry window (rtt × traffic-timeout × max-retries + grace) elapses with no activity — this also bounds the
final proof wait, which Python tightens with PROOF_TIMEOUT_FACTOR
(the tighter bound only speeds recovery; the max window already covers
it).
Receiver side: a part stall longer than PART_TIMEOUT_FACTOR × the
expected transfer time re-requests the missing parts (resetting the
window); exhausted retries cancel the transfer. Without this, a stalled
peer on a keepalive-sustained link — alive at the link layer, wedged at
the application layer — held its half-received parts (receiver) or its
full payload and encrypted part slices (sender) forever: links whose
endpoints keep answering keepalives never go stale, so nothing else
would ever release the buffers. Each retried sync cycle then
accumulated another stalled transfer, compounding into multi-GB heap
growth during sync-failure storms.
Current epoch ms (injected for testability).
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsBuilds and sends the RESOURCE_ADV (§10.4). The link registers this
resource as an outgoing transfer keyed by hash.
Receiver: assembles all parts, link-decrypts, strips the prefix, optional decompress, recomputes the integrity hash, and emits the RESOURCE_PRF (§10.8).
Cancels the resource. Sender emits RESOURCE_ICL; receiver cancels locally (an ordinary receiver cancel does NOT emit RESOURCE_RCL per §10.9).
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
Current transfer progress as a float in [0.0, 1.0].
Receiver: peer (initiator) cancelled via RESOURCE_ICL.
Sender: peer (receiver) rejected via RESOURCE_RCL.
Sender: fulfils an inbound RESOURCE_REQ (§10.5/§10.7) — emits the requested RESOURCE part packets, and a RESOURCE_HMU continuation when the receiver signalled hashmap exhaustion.
Receiver: applies a RESOURCE_HMU hashmap continuation (§10.7).
Receiver: places an incoming RESOURCE part by matching its 4-byte map_hash against the hashmap (§10.6). Returns true if the part was placed.
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Optionaloptions: boolean | EventListenerOptionsReceiver: builds and sends the next RESOURCE_REQ for missing parts
(§10.5). Windowed stop-and-wait for Phase 2 — requests up to window
outstanding missing parts, then waits for them before requesting more.
Sender: validates a RESOURCE_PRF (§10.8). Body is resource_hash(32) || full_proof(32); full_proof must equal the pre-computed expected_proof.
Resolves when the transfer reaches a terminal state (COMPLETE/FAILED/etc). Rejects if the resource fails rather than completing.
Static_Internal
Emits a RESOURCE_RCL rejection for a resource hash.
StaticacceptAccepts an inbound RESOURCE_ADV and prepares to receive parts (§10.4/§10.5).
Optionaloptions: { bz2?: Bzip2; maxParts?: number; maxSegments?: number; maxSize?: number } = {}
Optionalbz2?: Bzip2OptionalmaxParts?: numberReject advertisements whose part count
n exceeds this. Defaults to Resource.DEFAULT_MAX_PARTS.
OptionalmaxSegments?: numberReject split advertisements whose
total segment count l exceeds this. Defaults to
Resource.DEFAULT_MAX_SEGMENTS.
OptionalmaxSize?: numberReject advertisements whose t or d
exceeds this (§10.4 bomb defense). Defaults to 32 MiB.
null if the advertisement was rejected.
A Reticulum Resource — a fragmented transfer riding on top of an ACTIVE Link.
Construct with
datafor the sender side (thenawait resource.advertise()); or via Resource.accept on the receiver side. Both sides emitprogress/complete/failedevents, and exposewhenComplete()for promise-based consumers.