Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
snappy: function (buf, cb) {
// Avro appends checksums to compressed blocks, which we skip here.
return snappy.uncompress(buf.slice(0, buf.length - 4), cb);
}
};
uncompress(data) {
return promisify(snappy.uncompress)(data);
}
}
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) {