Convert base64 string to arraybuffer - Node.js String

Node.js examples for String:Base 64

Description

Convert base64 string to arraybuffer

Demo Code


base64ToArrayBuffer: function (base64) {
  var binary_string = window.atob(base64);
  var len = binary_string.length;
  var bytes = new Uint8Array(len);
  for (var i = 0; i < len; i++) {
    bytes[i] = binary_string.charCodeAt(i);
  }/*from  w w w  . j  ava  2  s .  c o  m*/
  return bytes.buffer;
},

Related Tutorials