Add `.file()` method
Turbo87 opened this issue · comments
I think it would be useful to add a path()
method that did something like:
function path(path, options) {
return new Promise((resolve, reject) => {
let stream = fs.createReadStream(path);
stream.on('error', reject);
stream.pipe(gzipSize.stream(options)).on('gzip-size', resolve);
});
}
Would that be a welcome PR?
Yes, that would be welcomed. Should be named .file()
though, and remember to also add an error handler on the gzipSize.stream
(Errors doesn't propagate in Node.js streams...).