Converts number into new Uint8Array
number to convert
number of bytes the result should have
Uint8Array
RangeError if bytes is less than 1 or number does not fit into bytes
converter.unsigned.be.toNewArray(1n, 2) // Uint8Array [ 0x00, 0x01 ]
converter.unsigned.be.toNewArray(-1n, 2) // RangeError: requested bigint is negative
converter.signed.be.toNewArray(-1n, 2) // Uint8Array [ 0xff, 0xff ]
Generated using TypeDoc
Base interface for all conversion operations