TextEncoder
and TextDecoder
from the Encoding standard, which is polyfilled by the stringencoding library, converts between strings and ArrayBuffers:
var uint8array = new TextEncoder().encode("ยข");
var string = new TextDecoder().decode(uint8array);