Utility to convert from byte arrays to word arrays - Node.js String

Node.js examples for String:Base 64

Description

Utility to convert from byte arrays to word arrays

Demo Code

function byte_to_word( array )
{
  var i = 0, l = array.length,
  result = [];//from ww  w  .  jav a  2s .  c  om
  while ( i < l )
  {
    result[i / 2] = array[i++] << 8 | array[i++];
  }
  return result;
}

Related Tutorials