How to use the msgpack-lite.decode function in msgpack-lite

To help you get started, we’ve selected a few msgpack-lite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SocketCluster / sc-codec-min-bin / index.js View on Github external
module.exports.decode = function (str) {
  str = new Uint8Array(str);
  var object = msgpack.decode(str, options);
  if (Array.isArray(object)) {
    var len = object.length;
    for (var i = 0; i < len; i++) {
      decompressSinglePacket(object[i]);
    }
  } else {
    decompressSinglePacket(object);
  }
  return object;
};
github SocketCluster / sc-codec-min-bin / sc-codec-min-bin.js View on Github external
module.exports.decode = function (str) {
  str = new Uint8Array(str);
  var object = msgpack.decode(str, options);
  if (Array.isArray(object)) {
    var len = object.length;
    for (var i = 0; i < len; i++) {
      decompressSinglePacket(object[i]);
    }
  } else {
    decompressSinglePacket(object);
  }
  return object;
};
github jwkvam / bowtie / bowtie / src / griddle.jsx View on Github external
socket.on(this.props.uuid + '#update', data => {
            var arr = new Uint8Array(data['data']);
            arr = msgpack.decode(arr);
            this.setState({ data: arr });
            storeState(this.props.uuid, this.state, { data: arr });
        });
github mixer / webpack-bundle-compare / src / client / worker / download.ts View on Github external
function processDownload(rawResponse: ArrayBuffer): Stats.ToJsonOutput {
  const asArray = new Uint8Array(rawResponse);
  const data = asArray[0] === 0x1f && asArray[1] === 0x8b ? inflate(asArray) : asArray;
  const stats: Stats.ToJsonOutput =
    data[0] === '{'.charCodeAt(0) ? JSON.parse(new TextDecoder().decode(data)) : decode(data);

  if (stats.modules) {
    stats.modules = stats.modules.filter(m => m.chunks.length !== 0);
  }

  return stats;
}
github K3D-tools / K3D-jupyter / js / src / core / Core.js View on Github external
this.setSnapshot = function (data) {
        data = msgpack.decode(pako.inflate(data), {codec: MsgpackCodec});

        Object.keys(data.chunkList).forEach(function (k) {
            data.chunkList[k] = {attributes: data.chunkList[k]};
        });

        self.setChunkList(data.chunkList);

        return self.load({objects: data.objects});
    };

msgpack-lite

Fast Pure JavaScript MessagePack Encoder and Decoder

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis

Popular msgpack-lite functions