Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var simple_s=JSON.stringify(simple);
var t2=hrnow();
console.log("simple:",simple_s.length, t2-t1);
var t3=hrnow();
var bulk_s=JSON.stringify(bulk);
var t4=hrnow();
console.log("bulk:", bulk_s.length, t4-t3);
var snappy=require("snappy");
var t5=hrnow();
snappy.compress(simple_s, function(err,compd) {
var t6=hrnow();
console.log("snappyed_simple:", compd.length, t6-t5);
});
var t7=hrnow();
snappy.compress(bulk_s, function(err,compd) {
var t8=hrnow();
console.log("snappyed_bulk:", compd.length, t8-t7);
});
var t9=hrnow();
var bytes_s=JSON.stringify(bytes);
var t10=hrnow();
console.log("bytes tojson:", bytes_s.length,t10-t9);
});
var t7=hrnow();
snappy.compress(bulk_s, function(err,compd) {
var t8=hrnow();
console.log("snappyed_bulk:", compd.length, t8-t7);
});
var t9=hrnow();
var bytes_s=JSON.stringify(bytes);
var t10=hrnow();
console.log("bytes tojson:", bytes_s.length,t10-t9);
snappy.compress(bytes_s, function(err,compd) {
var t11=hrnow();
console.log("snappyed_bytes:", compd.length, t11-t10);
});
require("./lzw.js");
var t11=hrnow();
var lzwout=lzw_encode(bytes_s);
var t12=hrnow();
console.log("lzw:", lzwout.length, t12-t11);
var bulk_s=JSON.stringify(bulk);
var t4=hrnow();
console.log("bulk:", bulk_s.length, t4-t3);
var snappy=require("snappy");
var t5=hrnow();
snappy.compress(simple_s, function(err,compd) {
var t6=hrnow();
console.log("snappyed_simple:", compd.length, t6-t5);
});
var t7=hrnow();
snappy.compress(bulk_s, function(err,compd) {
var t8=hrnow();
console.log("snappyed_bulk:", compd.length, t8-t7);
});
var t9=hrnow();
var bytes_s=JSON.stringify(bytes);
var t10=hrnow();
console.log("bytes tojson:", bytes_s.length,t10-t9);
snappy.compress(bytes_s, function(err,compd) {
var t11=hrnow();
console.log("snappyed_bytes:", compd.length, t11-t10);
});
require("./lzw.js");
CompressStream.prototype._transform = function (chunk, enc, callback) {
var self = this
snappy.compress(chunk, function (err, compressed) {
if (err)
return callback(err)
if (compressed.length < chunk.length)
self._compressed(chunk, compressed)
else
self._uncompressed(chunk)
callback()
})
}
compress(data) {
return promisify(snappy.compress)(data);
}