safe-buffer
safe-buffer copied to clipboard
For Uint8Array in Type script
This took me way to long to figure out. In order to pass a Uint8Array to functions that need the normal node Buffer Uint8Array Type you must convert to unknown type and then Uint8Array type.
let hexstring = "572f3c5e8167f8b2cacba8036b9b37c3cc48b6a349ebbac561eec0089d222451";
let uint8arraytype = <Uint8Array><unknown>Buffer.from(hexstring, 'hex');