I need an efficient (read native) way to convert an ArrayBuffer to a base64 string which needs to be used on a multipart post.
ArrayBuffer
For those who like it short, here's an other one using Array.reduce which will not cause stack overflow:
Array.reduce
var base64 = btoa( new Uint8Array(arrayBuffer) .reduce((data, byte) => data + String.fromCharCode(byte), '') );