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

Function deconstructPacket

packages/socket.io/client-dist/socket.io.js:3103–3113  ·  view source on GitHub ↗

* Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder. * * @param {Object} packet - socket.io event packet * @return {Object} with deconstructed packet and list of buffers * @public

(packet)

Source from the content-addressed store, hash-verified

3101 * @public
3102 */
3103 function deconstructPacket(packet) {
3104 var buffers = [];
3105 var packetData = packet.data;
3106 var pack = packet;
3107 pack.data = _deconstructPacket(packetData, buffers);
3108 pack.attachments = buffers.length; // number of binary 'attachments'
3109 return {
3110 packet: pack,
3111 buffers: buffers
3112 };
3113 }
3114 function _deconstructPacket(data, buffers) {
3115 if (!data) return data;
3116 if (isBinary(data)) {

Callers 2

encodeAsBinaryMethod · 0.90
socket.io.jsFile · 0.70

Calls 1

_deconstructPacketFunction · 0.70

Tested by

no test coverage detected