How to use the snappy.uncompress 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 kesla / node-snappy-stream / lib / uncompress-stream.js View on Github external
this.buffer.consume(4 + size)

  if (!this.foundIdentifier && type !== 'identifier')
    return callback(new Error('malformed input: must begin with an identifier'))

  if (type === 'identifier') {
    if(!bufferEqual(data, IDENTIFIER))
      return callback(new Error('malformed input: bad identifier'))

    this.foundIdentifier = true
    return this._parse(callback)
  }

  if (type === 'compressed') {
    // TODO: check that the checksum matches
    snappy.uncompress(data.slice(4), { asBuffer: this.asBuffer }, function (err, raw) {
      if(err) {
        return callback(err)
      }
      self.push(raw)
      self._parse(callback)
    })
    return
  }

  if (type === 'uncompressed') {
    // TODO: check that the checksum matches
    data = data.slice(4)

    if (!this.asBuffer)
      data = data.toString()
github elevy30 / bigdata-playground / spring-boot / spring-boot-avro / src / main / resources / node_avro.js View on Github external
snappy: function (buf, cb) {
            // Avro appends checksums to compressed blocks, which we skip here.
            return snappy.uncompress(buf.slice(0, buf.length - 4), cb);
        }
    };
github dbcls / sparql-proxy / src / compressor / snappy.js View on Github external
uncompress(data) {
    return promisify(snappy.uncompress)(data);
  }
}
github tmrowco / electricitymap-contrib / shared / database.js View on Github external
exports.decompressGfs = function (obj, callback) {
    if (!obj) return callback(null, null);
    return snappy.uncompress(obj, { asBuffer: true }, function (err, obj) {
        if (err) return callback(err);
        return callback(err, JSON.parse(obj));
    });
}
function queryForecasts(key, datetime, callback) {

snappy

Fastest Snappy compression library in Node.js

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis