API reference / @evolu/common / local-first/Protocol / encodeFlags

Function: encodeFlags()

function encodeFlags(buffer, flags): void;

Defined in: packages/common/src/local-first/Protocol.ts:1681

Encodes an array of boolean flags into a single byte.

Each element in the array corresponds to a bit (0-7). Array can have 0-8 elements.

Example

encodeFlags(buffer, [true, false, true]); // Encodes bits 0, 1, 2

Parameters

ParameterType
bufferBuffer
flagsreadonly boolean[]

Returns

void

Was this page helpful?