How to use the snappy.compressSync function in snappy

To help you get started, we’ve selected a few snappy 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 albertdb / Raft / server.js View on Github external
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]);
    }
}
github albertdb / Raft / client.js View on Github external
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(){
github albertdb / Raft / server.js View on Github external
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]);
    }
}
github zhipeng-jia / snappyjs / benchmark.js View on Github external
function prepareData (target, text) {
  var uncompressedBuffer = Buffer.alloc(text)
  var compressedBuffer = snappy.compressSync(uncompressedBuffer)
  target.uncompressedBuffer = uncompressedBuffer
  target.compressedBuffer = compressedBuffer
}
github zhipeng-jia / snappyjs / benchmark.js View on Github external
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

snappy

Fastest Snappy compression library in Node.js

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis