API reference › @evolu/common › Bytes › RunLengthEncoder
Defined in: packages/common/src/Bytes.ts:560
Incrementally encodes consecutive equal values using run-length encoding.
Properties
add
readonly add: (value: T) => void;
Defined in: packages/common/src/Bytes.ts:561
checkpoint
readonly checkpoint: () => () => void;
Defined in: packages/common/src/Bytes.ts:572
Returns a function that restores the encoder, in constant time, to the state it had when this was called, discarding every value added since.
A restore function can be called repeatedly. It is valid until the encoder is restored to an earlier checkpoint.
getLength
readonly getLength: () => number & Brand<"NonNaN"> & Brand<"Finite"> & Brand<"Int"> & Brand<"NonNegative">;
Defined in: packages/common/src/Bytes.ts:562
unwrap
readonly unwrap: () => Uint8Array;
Defined in: packages/common/src/Bytes.ts:563