hex-array
Creates Uint8Array buffers from hexadecimal strings, and vice versa.
Installation
npm install hex-array
Usage
var hexarray = ; hexarray
Methods
hexarray.toString(array, [options])
converts the given buffer to a string containing its hexadecimal representation.
array
a Uint8Array buffer to convert.
options
an optional object with the following members:
-
grouping
this number of hex bytes are grouped together with spaces between groups. 0 means no grouping is applied. 0 if unspecified. -
rowlength
the number of groups which make up a row. When 0, no splitting into rows occurs. 0 if unspecified. -
uppercase
if true, the output will be in uppercase. true by default.
return
a hexadecimal string representing the buffer.
hexarray.fromString(string)
takes a string containing hexadecimal and returns the equivalent as a Uint8Array buffer.
string
The string to convert. Whitespace is ignored. If an odd number of
characters are specified, it will act as if preceeded with a leading 0; that
is, "FFF" is equivalent to "0FFF".
return
a Uint8Array array.
Tests
npm test