Skip to content

Instantly share code, notes, and snippets.

@amirhaleem
Created February 28, 2014 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirhaleem/9264331 to your computer and use it in GitHub Desktop.
Save amirhaleem/9264331 to your computer and use it in GitHub Desktop.
$http.get('http://127.0.0.1:8077/').success(function(res){
var buf = new ArrayBuffer(res.length / 2);
var bufView = new Uint8Array(buf);
for (var i=0, strLen=res.length; i<strLen; i++) {
var zIndex = i * 2;
var firstChar = res[zIndex];
var secondChar = res[zIndex + 1];
var combinedChar = firstChar + secondChar;
bufView[i] = parseInt(combinedChar, 16)
}
var decoded = msgpack.decode(bufView);
console.log(decoded.P);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment