Skip to content

Commit

Permalink
Require Node.js 6
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
sindresorhus committed Jul 5, 2018
1 parent 43fcdfa commit 442ea63
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 49 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '10'
- '8'
- '6'
- '4'
7 changes: 1 addition & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down Expand Up @@ -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);
76 changes: 38 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": "*"
}
}
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 442ea63

Please sign in to comment.