Class: WirehairEncoderRaw

WirehairEncoderRaw()

Encapsulates the Wirehair encoding functionality for raw packets (no headers). Use this class to encode a message into a series of raw data packets.

Constructor

new WirehairEncoderRaw()

Creates an instance of WirehairEncoderRaw. Only usable after calling await initWirehairModule(). Consider using WirehairEncoderRaw.create() instead.
Source:

Classes

WirehairEncoderRaw

Methods

encode(blockId) → {Uint8Array}

Encodes a block of the message with the given blockId.
Parameters:
Name Type Description
blockId number The ID of the block to encode.
Source:
Throws:
If Wirehair encoding fails.
Type
Error
Returns:
A raw packet containing the encoded block data.
Type
Uint8Array

free()

Frees the resources associated with this encoder instance in the WebAssembly module. Call this method when the encoder is no longer needed to prevent memory leaks.
Source:

setMessage(messageU8, packetSize)

Sets the message to be encoded and initializes the encoder for raw output.
Parameters:
Name Type Description
messageU8 Uint8Array The message data as a Uint8Array.
packetSize number The desired size of each encoded data payload. This will be adjusted if it's too large for the message.
Source:
Throws:
If WASM buffer allocation fails.
Type
Error

(async, static) create() → {Promise.<WirehairEncoderRaw>}

Asynchronously creates and initializes a WirehairEncoderRaw instance. Ensures the Wirehair WebAssembly module is initialized before creating the encoder.
Source:
Returns:
A promise that resolves to a new WirehairEncoderRaw instance.
Type
Promise.<WirehairEncoderRaw>