MCPcopy
hub / github.com/socketio/socket.io / mapBinary

Function mapBinary

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

Source from the content-addressed store, hash-verified

330 }
331 };
332 var mapBinary = function mapBinary(data, binaryType) {
333 switch (binaryType) {
334 case "blob":
335 if (data instanceof Blob) {
336 // from WebSocket + binaryType "blob"
337 return data;
338 } else {
339 // from HTTP long-polling or WebTransport
340 return new Blob([data]);
341 }
342 case "arraybuffer":
343 default:
344 if (data instanceof ArrayBuffer) {
345 // from HTTP long-polling (base64) or WebSocket + binaryType "arraybuffer"
346 return data;
347 } else {
348 // from WebTransport (Uint8Array)
349 return data.buffer;
350 }
351 }
352 };
353
354 var SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
355 var encodePayload = function encodePayload(packets, callback) {

Callers 2

decodePacketFunction · 0.70
decodeBase64PacketFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected