MCPcopy Create free account
hub / github.com/socketio/socket.io / mapBinary

Function mapBinary

client-dist/socket.io.js:419–439  ·  view source on GitHub ↗
(data, binaryType)

Source from the content-addressed store, hash-verified

417 };
418
419 var mapBinary = function mapBinary(data, binaryType) {
420 switch (binaryType) {
421 case "blob":
422 if (data instanceof Blob) {
423 // from WebSocket + binaryType "blob"
424 return data;
425 } else {
426 // from HTTP long-polling or WebTransport
427 return new Blob([data]);
428 }
429 case "arraybuffer":
430 default:
431 if (data instanceof ArrayBuffer) {
432 // from HTTP long-polling (base64) or WebSocket + binaryType "arraybuffer"
433 return data;
434 } else {
435 // from WebTransport (Uint8Array)
436 return data.buffer;
437 }
438 }
439 };
440
441 var SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
442 var encodePayload = function encodePayload(packets, callback) {

Callers 2

decodePacketFunction · 0.85
decodeBase64PacketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected