@spa-tools/utilities
base64ToBytes()
The base64ToBytes() function converts a base64 string to its equivalent byte array.
Usage
import { base64ToBytes } from '@spa-tools/utilities';
const base64String = 'SGVsbG8gV29ybGQ=';
const bytes = base64ToBytes(base64String);
console.log(bytes);
// --> [72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
Arguments
| Name | Type | Description | 
|---|---|---|
base64 | string | The base64 string to convert | 
Returns
Returns a Uint8Array.