Convert Ascii to Uint8 Array - Node.js Data Type

Node.js examples for Data Type:Uint8Array

Description

Convert Ascii to Uint8 Array

Demo Code


function asciiToUint8Array(str){
  var chars = [];
  for (var i = 0; i < str.length; ++i){
    chars.push(str.charCodeAt(i));/*from  w  ww. j  a  v  a  2s.c o  m*/
  }
  return new Uint8Array(chars);
}

Related Tutorials