evothings. util
Source: evothings-libraries/
Utilities for byte arrays.
Methods
Methods
base64DecToArr(sBase64, nBlocksSize) → Uint8Array
Decodes a Base64 string. Returns a Uint8Array. nBlocksSize is optional.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
sBase64 |
String |
|
|
nBlocksSize |
int |
|
- Returns
-
Uint8Array
bigEndianToInt16(data, offset)
Interpret byte buffer as signed big endian 16 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
bigEndianToUint16(data, offset)
Interpret byte buffer as unsigned big endian 16 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
bigEndianToUint32(data, offset)
Interpret byte buffer as unsigned big endian 32 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
littleEndianToInt8(data, offset)
Interpret byte buffer as little endian 8 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
littleEndianToInt16(data, offset)
Interpret byte buffer as little endian 16 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
littleEndianToUint8(data, offset)
Interpret byte buffer as unsigned little endian 8 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
littleEndianToUint16(data, offset)
Interpret byte buffer as unsigned little endian 16 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
littleEndianToUint32(data, offset)
Interpret byte buffer as unsigned little endian 32 bit integer. Returns converted number.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
data |
ArrayBuffer |
|
Input buffer. |
offset |
number |
|
Start of data. |
- Returns
-
Converted number.
toHexString(i, byteCount)
Returns the integer i in hexadecimal string form, with leading zeroes, such that the resulting string is at least byteCount*2 characters long.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
i |
int |
|
|
byteCount |
int |
|
typedArrayToHexString(data)
Takes a ArrayBuffer or TypedArray and returns its hexadecimal representation. No spaces or linebreaks.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
data |
|
|