A safe Uint8Array to base64 string converter
Social Media Photo by Suzanne D. Williams on Unsplash
Compatible with any binary data and every modern JS engine.
;// const {encode, decode} = require('uint8-to-base64'); const utf8Binary = anyArrayBuffer; // encode converts Uint8Array instances to utf-16 stringsconst encoded = ; // it's just like any other stringsconsole; // decode converts utf-16 strings, encoded via this module,// into their original Uint8Array representationconst decoded = ; console;
Please note this module requires global atob
and btoa
in NodeJS, polyfilled in tests in here as such.
global Buffer;global Buffer;
Looking for a drop in module that converts into utf-16 strings instead? Check uint8-to-utf16 out!