Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function sendMessageToClient(destination,message){
if(debug) console.log(message);
if(message.length<1000) clientSocket.send(['','c'+destination,'',message]);
else{
message=snappy.compressSync(message);
clientSocket.send(['','c'+destination,'c',message]);
}
}
function sendMessageToServer(destination,message){
if(debug) console.log('Client: ',message);
if(message.length<1000) clientSocket.send(['','s'+destination,'',message]);
else{
message=snappy.compressSync(message);
clientSocket.send(['','s'+destination,'c',message]);
}
}
clientSocket.on('message',function(){
function sendMessage(destination,message){
if(debug) console.log(message);
if(message.length<1000) socket.send(['',destination,'',message]);
else{
message=snappy.compressSync(message);
socket.send(['',destination,'c',message]);
}
}
function prepareData (target, text) {
var uncompressedBuffer = Buffer.alloc(text)
var compressedBuffer = snappy.compressSync(uncompressedBuffer)
target.uncompressedBuffer = uncompressedBuffer
target.compressedBuffer = compressedBuffer
}
suite.add('node-snappy#compress', function () {
var i
if (data.repeatedTimes) {
for (i = 0; i < data.repeatedTimes; i++) {
snappy.compressSync(data.uncompressedBuffer)
}
} else {
snappy.compressSync(data.uncompressedBuffer)
}
}).add('snappyjs#compress', function () {
var i