padBytes
Call Signature
Pads a Uint8Array
with zeroes to the specified length.
If the array is longer than the specified length, it is returned as-is.
Parameters
Parameter | Type | Description |
---|---|---|
bytes | Uint8Array | The byte array to pad. |
length | number | The desired length of the byte array. |
Returns
Examples
Adds zeroes to the end of the byte array to reach the desired length.
Returns the original byte array if it is already at the desired length.
Call Signature
Pads a Uint8Array
with zeroes to the specified length.
If the array is longer than the specified length, it is returned as-is.
Parameters
Parameter | Type | Description |
---|---|---|
bytes | ReadonlyUint8Array | The byte array to pad. |
length | number | The desired length of the byte array. |
Returns
Examples
Adds zeroes to the end of the byte array to reach the desired length.
Returns the original byte array if it is already at the desired length.