Created
November 3, 2012 13:45
-
-
Save SunboX/4007422 to your computer and use it in GitHub Desktop.
ArrayBuffer to String conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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