Byte Buffers in Calculators

Byte Buffers are useful for converting between different encodings, especially base64. The calculator provides the following helper functions. Byte Buffers in calculators are not the same as Synatic Buffers.

Create a Buffer

utils.createBuffer(obj,type)

Example:

let buffer=utils.createBuffer('this is a test');
//creates a base64 string from the buffer
let base64=buffer.toString('base64');
//supports base64, hex, ascii, utf8, binary
let newString=utils.createBuffer(base64,'base64').toString();
//returns this is a test

Create a concatenated Buffer

utils.concatBuffer(buffArr)

Example:

let buffer1=utils.createBuffer('this is a test1');
let buffer2=utils.createBuffer('this is a test2');
let concatBuffer=utils.concatBuffer([buffer1,buffer2]);
let newString=concatBuffer.toString('base64');