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

Function encodePacketToBinary

packages/socket.io/client-dist/socket.io.js:245–257  ·  view source on GitHub ↗
(packet, callback)

Source from the content-addressed store, hash-verified

243 }
244 var TEXT_ENCODER;
245 function encodePacketToBinary(packet, callback) {
246 if (withNativeBlob$1 && packet.data instanceof Blob) {
247 return packet.data.arrayBuffer().then(toArray).then(callback);
248 } else if (withNativeArrayBuffer$2 && (packet.data instanceof ArrayBuffer || isView$1(packet.data))) {
249 return callback(toArray(packet.data));
250 }
251 encodePacket(packet, false, function (encoded) {
252 if (!TEXT_ENCODER) {
253 TEXT_ENCODER = new TextEncoder();
254 }
255 callback(TEXT_ENCODER.encode(encoded));
256 });
257 }
258
259 // imported from https://github.com/socketio/base64-arraybuffer
260 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

Callers 2

transformFunction · 0.90

Calls 5

isView$1Function · 0.85
callbackFunction · 0.70
toArrayFunction · 0.70
encodePacketFunction · 0.70
encodeMethod · 0.65

Tested by

no test coverage detected