Binary data to decode
Result containing decoded value, or DecodeError on validation failure
Basic decoding:
import { decode } from '@grounds/core';
const bytes = new Uint8Array([0x02, 0x2a]); // U8(42)
decode(bytes).match(
(value) => console.log(value), // 42
(error) => console.error(error.message)
);
Returns raw JavaScript values (DecodedValue), not wrapped RelishValue objects. This differs from the encode API which accepts RelishValue wrappers. The asymmetry simplifies consumption: decoded data can be used directly without unwrapping.
Decodes bytes to a raw JavaScript value using the Relish wire format.
Convenience wrapper around Decoder for one-shot decoding. For decoding multiple values or streaming scenarios, use Decoder directly.