Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
};
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;
};
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 });
});
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;
}
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});
};