CBORReader
CBOR reader.
- CBORReader
- .constructor(data) ⇒ CBORReader
- .data: Uint8Array
- .dataView: DataView
- .dictionary: ‘object’ | ‘map’
- .offset: number
- .tagger: Tagger
- .appendUtf16Data(utf16data, length) ⇒ void
- .decodeItem() ⇒ any
- .readArrayBuffer(length) ⇒ Uint8Array
- .readArrayLength(typeInfo) ⇒ number | bigint
- .readBreak() ⇒ boolean
- .readFloat16() ⇒ number
- .readFloat32() ⇒ number
- .readFloat64() ⇒ number
- .readIndefiniteStringLength(majorType) ⇒ number
- .readItem(typeInfo) ⇒ any
- .readLength(additionalInformation) ⇒ number | bigint
- .readTypeInfo() ⇒ number
- .readUint16() ⇒ number
- .readUint32() ⇒ number
- .readUint64() ⇒ bigint
- .readUint8() ⇒ number
.constructor(data: Uint8Array) ⇒ CBORReader
Param | Type | Description |
---|---|---|
data | Uint8Array |
.data: Uint8Array
.dataView: DataView
.dictionary: ‘object’ | ‘map’
.offset: number
.tagger: Tagger
.appendUtf16Data(utf16data: number[], length: number) ⇒ void
Param | Type | Description |
---|---|---|
utf16data | number[] | |
length | number |
.decodeItem() ⇒ any
.readArrayBuffer(length: number) ⇒ Uint8Array
Param | Type | Description |
---|---|---|
length | number |
.readArrayLength(typeInfo: number) ⇒ number | bigint
Read the array length.
Note: Must not be called if the type is a constant.
Returns: The array length.
Param | Type | Description |
---|---|---|
typeInfo | number | Type information obtained using readTypeInfo . |
.readBreak() ⇒ boolean
.readFloat16() ⇒ number
.readFloat32() ⇒ number
.readFloat64() ⇒ number
.readIndefiniteStringLength(majorType: number) ⇒ number
Param | Type | Description |
---|---|---|
majorType | number |
.readItem(typeInfo: number) ⇒ any
Recursively read the item.
Note: This method will recursively allocate arrays and records based the item type.
Returns: The decoded value.
Param | Type | Description |
---|---|---|
typeInfo | number | Type information obtained using readTypeInfo . |
.readLength(additionalInformation: number) ⇒ number | bigint
Param | Type | Description |
---|---|---|
additionalInformation | number |
.readTypeInfo() ⇒ number
Read type information and move the cursor.
Note: Must be called before reading the value.