Convert a signed bigint to a Uint8Array. This uses two's complement encoding to represent negative numbers.
bigint
Uint8Array
To convert an unsigned bigint to a Uint8Array instead, use bigIntToBytes.
https://en.wikipedia.org/wiki/Two%27s_complement
The bytes as Uint8Array.
The number to convert to bytes.
The length of the resulting Uint8Array. If the number is larger than the maximum value that can be represented by the given length, an error is thrown.
Convert a signed
bigint
to aUint8Array
. This uses two's complement encoding to represent negative numbers.To convert an unsigned
bigint
to aUint8Array
instead, use bigIntToBytes.See
https://en.wikipedia.org/wiki/Two%27s_complement
Returns
The bytes as
Uint8Array
.