Skip to content

Instantly share code, notes, and snippets.

@SunboX
Created November 3, 2012 13:45
Show Gist options
  • Select an option

  • Save SunboX/4007422 to your computer and use it in GitHub Desktop.

Select an option

Save SunboX/4007422 to your computer and use it in GitHub Desktop.
ArrayBuffer to String conversion
function ab2str(buf) {
var result = '';
if (buf) {
var bytes = new Uint8Array(buf);
for (var i = 0; i < bytes.byteLength; i++) {
result = result + String.fromCharCode(bytes[i]);
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment