Nodejs Hex to Binary Convert hex2bin()

Here you can find the source of hex2bin()

Method Source Code

String.prototype.hex2bin = function ()
{

  var i = 0, l = this.length - 1, bytes = []

  for (i; i < l; i += 2)
  {/*from   w  w  w  .j  a v a  2 s.  com*/
    bytes.push(parseInt(this.substr(i, 2), 16))
  }

  return String.fromCharCode.apply(String, bytes)   

}

Related

  1. hex2bin()
    String.prototype.hex2bin = function () {
      var i = 0, l = this.length - 1, bytes = []
      for (i; i < l; i += 2)
        bytes.push(parseInt(this.substr(i, 2), 16))
      return String.fromCharCode.apply(String, bytes)