We value your privacy. We use cookies to enhance your experience on our site. By using this site you agree to our Privacy Policy.

CBORReader

CBOR reader.

.constructor(data: Uint8Array) ⇒ CBORReader 

ParamTypeDescription
dataUint8Array

.data: Uint8Array 

.dataView: DataView 

.dictionary: ‘object’ | ‘map’ 

.offset: number 

.tagger: Tagger 

.appendUtf16Data(utf16data: number[], length: number) ⇒ void 

ParamTypeDescription
utf16datanumber[]
lengthnumber

.decodeItem() ⇒ any 

.readArrayBuffer(length: number) ⇒ Uint8Array 

ParamTypeDescription
lengthnumber

.readArrayLength(typeInfo: number) ⇒ number | bigint 

Read the array length.

Note: Must not be called if the type is a constant.

Returns: The array length.

ParamTypeDescription
typeInfonumberType information obtained using readTypeInfo.

.readBreak() ⇒ boolean 

.readFloat16() ⇒ number 

.readFloat32() ⇒ number 

.readFloat64() ⇒ number 

.readIndefiniteStringLength(majorType: number) ⇒ number 

ParamTypeDescription
majorTypenumber

.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.

ParamTypeDescription
typeInfonumberType information obtained using readTypeInfo.

.readLength(additionalInformation: number) ⇒ number | bigint 

ParamTypeDescription
additionalInformationnumber

.readTypeInfo() ⇒ number 

Read type information and move the cursor.

Note: Must be called before reading the value.

.readUint16() ⇒ number 

.readUint32() ⇒ number 

.readUint64() ⇒ bigint 

.readUint8() ⇒ number