MCPcopy Create free account
hub / github.com/hoothin/UserScripts / buf2binstring

Function buf2binstring

Picviewer CE+/dist.user.js:5847–5860  ·  view source on GitHub ↗
(buf, len)

Source from the content-addressed store, hash-verified

5845
5846// Helper (used in 2 places)
5847function buf2binstring(buf, len) {
5848 // use fallback for big arrays to avoid stack overflow
5849 if (len < 65537) {
5850 if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
5851 return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
5852 }
5853 }
5854
5855 var result = '';
5856 for (var i = 0; i < len; i++) {
5857 result += String.fromCharCode(buf[i]);
5858 }
5859 return result;
5860}
5861
5862
5863// Convert byte array to binary string

Callers 1

dist.user.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected