MCPcopy Create free account
hub / github.com/socketio/socket.io / decode$1

Function decode$1

client-dist/socket.io.js:352–379  ·  view source on GitHub ↗
(base64)

Source from the content-addressed store, hash-verified

350 lookup$1[chars.charCodeAt(i$1)] = i$1;
351 }
352 var decode$1 = function decode(base64) {
353 var bufferLength = base64.length * 0.75,
354 len = base64.length,
355 i,
356 p = 0,
357 encoded1,
358 encoded2,
359 encoded3,
360 encoded4;
361 if (base64[base64.length - 1] === '=') {
362 bufferLength--;
363 if (base64[base64.length - 2] === '=') {
364 bufferLength--;
365 }
366 }
367 var arraybuffer = new ArrayBuffer(bufferLength),
368 bytes = new Uint8Array(arraybuffer);
369 for (i = 0; i < len; i += 4) {
370 encoded1 = lookup$1[base64.charCodeAt(i)];
371 encoded2 = lookup$1[base64.charCodeAt(i + 1)];
372 encoded3 = lookup$1[base64.charCodeAt(i + 2)];
373 encoded4 = lookup$1[base64.charCodeAt(i + 3)];
374 bytes[p++] = encoded1 << 2 | encoded2 >> 4;
375 bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
376 bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
377 }
378 return arraybuffer;
379 };
380
381 var withNativeArrayBuffer$1 = typeof ArrayBuffer === "function";
382 var decodePacket = function decodePacket(encodedPacket, binaryType) {

Callers 1

decodeBase64PacketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected