WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

50
node_modules/gzip-size/index.js generated vendored Normal file
View File

@ -0,0 +1,50 @@
'use strict';
var duplexer = require('duplexer');
var stream = require('stream');
var zlib = require('zlib');
var opts = {level: 9};
module.exports = function (str, cb) {
if (!str) {
cb(null, 0);
return;
}
zlib.gzip(str, opts, function (err, data) {
if (err) {
cb(err, 0);
return;
}
cb(err, data.length);
});
};
module.exports.sync = function (str) {
return zlib.gzipSync(str, opts).length;
};
module.exports.stream = function () {
var input = new stream.PassThrough();
var output = new stream.PassThrough();
var wrapper = duplexer(input, output);
var gzipSize = 0;
var gzip = zlib.createGzip(opts)
.on('data', function (buf) {
gzipSize += buf.length;
})
.on('error', function () {
wrapper.gzipSize = 0;
})
.on('end', function () {
wrapper.gzipSize = gzipSize;
wrapper.emit('gzip-size', gzipSize);
output.end();
});
input.pipe(gzip);
input.pipe(output, {end: false});
return wrapper;
};