An object acceptable to Encoder.encode().
An encodable TLV structure.
First item is a number for TLV-TYPE. Optional second item could be OmitEmpty to omit the TLV if TLV-VALUE is empty. Subsequent items are Encodables for TLV-VALUE.
Create Encodable from non-negative integer.
Convert hexadecimal string to byte array.
This function lacks error handling. Use on trusted input only.
Pretty-print TLV-TYPE number.
Convert byte array to upper-case hexadecimal string.
Generated using TypeDoc
@ndn/tlv
This package is part of NDNts, Named Data Networking libraries for the modern web.
This package implements Type-Length-Value structure encoder and decoder as specified in NDN Packet Format v0.3. It has full support for TLV evolvability guidelines.
Encoder
The Encoder has an internal buffer of
Uint8Array
type. It prepends any encodable items to the internal buffer, and reallocates a larger buffer when necessary.Decoder
The Decoder is a basic sequential decoder.
EvDecoder
The EvDecoder is a decoder that is aware of TLV evolvability guidelines. It's used to implement decoding functions of TLV objects, such as
Interest.decodeFrom
.Suppose we want to decode NLSR's LSDB Dataset: