Convert BigInt to big-endian buffer with specified width.
BigInt value to convert
Desired buffer width in bytes
Big-endian buffer of exactly width bytes
width
const buf = toBufferBE(16909060n, 4);// Uint8Array [0x01, 0x02, 0x03, 0x04] Copy
const buf = toBufferBE(16909060n, 4);// Uint8Array [0x01, 0x02, 0x03, 0x04]
Convert BigInt to big-endian buffer with specified width.