801 B
801 B
u8a
Utility methods to convert to and from Uint8Array objects
- u8aFromBuffer Creates a Uint8Array value from a Buffer object.
- u8aToBuffer Creates a Buffer object from a hex string.
u8aFromBuffer
Creates a Uint8Array value from a Buffer object. (alias of bufferToU8a)
u8aFromBuffer (value?: Buffer): number
u8aToBuffer
Creates a Buffer object from a hex string.
u8aToBuffer (value?: UInt8Array): Buffer
null inputs returns an empty Buffer result. UInt8Array input values return the actual bytes value converted to a Buffer. Anything that is not a UInt8Array throws an error.
import { u8aToBuffer } from '@polkadot/util';
console.log('Buffer', u8aToBuffer('0x123480001f'));