| Function | Description |
|---|---|
| after(previous, innerFn) | Lets you analyze previous bytes to declare an appropiate Deconstructor for the following ones. |
| flags(flagNames) | Lets you decode a series of 0s and 1s into a Record of booleans |
| fromBuffer(deconstructor, input, offset) | Executes a Deconstructor on a Buffer, and returns its result |
| list(deconstructor, times) | Repeats a deconstructor a number of times, or as much as possible if not given |
| magicNumber(value) | Extract a specific sequence of bytes. Errors if they don’t match |
| maybe(inner, defaultValue) | Applies a deconstructor, returns the default value if it fails |
| raw(bytes) | Extracts a sub-range of bytes |
| rawUntil(value) | Extracts a sub-range of bytes |
| skip(bytes) | Extracts a specific number of bytes and ignores them |
| string(bytes, encoding) | Extracts a specific number of bytes and tries to decode them with the given encoding |
| stringUntil(value, encoding) | Read a string until it hits a specific value |
| struct() | Provides facilities to extract an object of different, named values. |
| structPairs(pairs) | Returns an object with the given key-value pairs |
| transform(inner, transformFn) | Creates a new Deconstructor that transforms the value returned by the previous one |
| Interface | Description |
|---|---|
| ComplexDeconstructor | The object or instance returned by your function, with information on the deconstructor and the deconstructor value, if it contains more than one value. |
| Deconstruction | Result of a deconstructed buffer |
| Deconstructor | The object or instance returned by your function, with information on the deconstructor and the deconstructor value. |
| Variable | Description |
|---|---|
| boolean | Reads a 0 or a 1 and returns a boolean |
| empty | Returns a Deconstructor that doesn’t do anything - a noop. Useful for testing and internals. |
| f32BE | Extracts an big-endian 32-bit float |
| f32LE | Extracts an little-endian 32-bit float |
| f64BE | Extracts an big-endian 64-bit float (double) |
| f64LE | Extracts an little-endian 64-bit float (double) |
| i16BE | Extracts an big-endian signed 16-bit integer |
| i16LE | Extracts an little-endian signed 16-bit integer |
| i32BE | Extracts an big-endian signed 32-bit integer |
| i32LE | Extracts an little-endian signed 32-bit integer |
| i64BE | Extracts an big-endian signed 64-bit BigInt |
| i64LE | Extracts an little-endian signed 64-bit BigInt |
| i8 | Extracts an signed 8-bit integer |
| u16BE | Extracts an big-endian unsigned 16-bit integer |
| u16LE | Extracts an little-endian unsigned 16-bit integer |
| u32BE | Extracts an big-endian unsigned 32-bit integer |
| u32LE | Extracts an little-endian unsigned 32-bit integer |
| u64BE | Extracts an big-endian unsigned 64-bit BigInt |
| u64LE | Extracts an little-endian unsigned 64-bit BigInt |
| u8 | Extracts an unsigned 8-bit integer |
| Type Alias | Description |
|---|---|
| StaticDeconstructor | This is a Deconstructor which you can call or use as-is |
| StructDeconstructor | Dynamic deconstructor that represents a struct |