diff --git a/.gitattributes b/.gitattributes index 391f0a4..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -* text=auto -*.js text eol=lf +* text=auto eol=lf diff --git a/.travis.yml b/.travis.yml index 7d69d74..2ae9d62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: + - '10' - '8' - '6' - - '4' diff --git a/index.js b/index.js index 8696fd5..8a9b993 100644 --- a/index.js +++ b/index.js @@ -12,8 +12,6 @@ module.exports = (input, options) => { return Promise.resolve(0); } - // TODO: Remove below comment when new XO release is out - // eslint-disable-next-line no-unused-vars, unicorn/catch-error-name return pify(zlib.gzip)(input, getOptions(options)).then(data => data.length).catch(_ => 0); }; @@ -55,7 +53,4 @@ module.exports.file = (path, options) => { }); }; -module.exports.fileSync = (path, options) => { - const data = fs.readFileSync(path); - return module.exports.sync(data, options); -}; +module.exports.fileSync = (path, options) => module.exports.sync(fs.readFileSync(path), options); diff --git a/package.json b/package.json index 52e710b..fedd14a 100644 --- a/package.json +++ b/package.json @@ -1,40 +1,40 @@ { - "name": "gzip-size", - "version": "4.1.0", - "description": "Get the gzipped size of a string or buffer", - "license": "MIT", - "repository": "sindresorhus/gzip-size", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "app", - "tool", - "zlib", - "gzip", - "compressed", - "size", - "string", - "buffer" - ], - "dependencies": { - "duplexer": "^0.1.1", - "pify": "^3.0.0" - }, - "devDependencies": { - "ava": "*", - "p-event": "^1.3.0", - "xo": "*" - } + "name": "gzip-size", + "version": "4.1.0", + "description": "Get the gzipped size of a string or buffer", + "license": "MIT", + "repository": "sindresorhus/gzip-size", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "app", + "tool", + "zlib", + "gzip", + "compressed", + "size", + "string", + "buffer" + ], + "dependencies": { + "duplexer": "^0.1.1", + "pify": "^3.0.0" + }, + "devDependencies": { + "ava": "*", + "p-event": "^2.1.0", + "xo": "*" + } } diff --git a/test.js b/test.js index 0ece1d9..5678b7e 100644 --- a/test.js +++ b/test.js @@ -42,8 +42,8 @@ test('passthrough', async t => { const stream = fs.createReadStream('test.js') .pipe(m.stream()) - .on('data', buf => { - out += buf; + .on('data', buffer => { + out += buffer; }); await pEvent(stream, 'end');