Skip to content

datasource.base64Bytes ^v2.6.185 ​

Decodes a base64 string into an array of bytes.

js
datasource.base64Bytes(base64)

Parameters ​

ParameterTypeDescription
base64stringThe base64 string to decode.

Returns ​

number[]

The decoded bytes, each a value from 0 to 255. Pass them to datasource.writeFile to save them to a file.

Examples ​

js
const myBase64String = "SGVsbG8gV29ybGQ="; // Hello World
const decodedBytes = datasource.base64Bytes(myBase64String);
// decodedBytes would be a byte array of the following in this example.
// [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]