Comparing version 5.0.1 to 6.0.0
30
index.js
'use strict'; | ||
var stdin = process.stdin; | ||
const stdin = process.stdin; | ||
module.exports = function () { | ||
var ret = ''; | ||
module.exports = () => { | ||
let ret = ''; | ||
return new Promise(function (resolve) { | ||
return new Promise(resolve => { | ||
if (stdin.isTTY) { | ||
@@ -15,4 +15,4 @@ resolve(ret); | ||
stdin.on('readable', function () { | ||
var chunk; | ||
stdin.on('readable', () => { | ||
let chunk; | ||
@@ -24,3 +24,3 @@ while ((chunk = stdin.read())) { | ||
stdin.on('end', function () { | ||
stdin.on('end', () => { | ||
resolve(ret); | ||
@@ -31,14 +31,14 @@ }); | ||
module.exports.buffer = function () { | ||
var ret = []; | ||
var len = 0; | ||
module.exports.buffer = () => { | ||
const ret = []; | ||
let len = 0; | ||
return new Promise(function (resolve) { | ||
return new Promise(resolve => { | ||
if (stdin.isTTY) { | ||
resolve(new Buffer('')); | ||
resolve(Buffer.concat([])); | ||
return; | ||
} | ||
stdin.on('readable', function () { | ||
var chunk; | ||
stdin.on('readable', () => { | ||
let chunk; | ||
@@ -51,3 +51,3 @@ while ((chunk = stdin.read())) { | ||
stdin.on('end', function () { | ||
stdin.on('end', () => { | ||
resolve(Buffer.concat(ret, len)); | ||
@@ -54,0 +54,0 @@ }); |
{ | ||
"name": "get-stdin", | ||
"version": "5.0.1", | ||
"description": "Get stdin as a string or buffer", | ||
"license": "MIT", | ||
"repository": "sindresorhus/get-stdin", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.12.0" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava test.js && echo unicorns | ava test-real.js" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"std", | ||
"stdin", | ||
"stdio", | ||
"concat", | ||
"buffer", | ||
"stream", | ||
"process", | ||
"read" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"buffer-equals": "^1.0.3", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"ignores": [ | ||
"test.js" | ||
] | ||
} | ||
"name": "get-stdin", | ||
"version": "6.0.0", | ||
"description": "Get stdin as a string or buffer", | ||
"license": "MIT", | ||
"repository": "sindresorhus/get-stdin", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava test.js test-buffer.js && echo unicorns | node test-real.js" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"std", | ||
"stdin", | ||
"stdio", | ||
"concat", | ||
"buffer", | ||
"stream", | ||
"process", | ||
"read" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) | ||
``` | ||
$ npm install --save get-stdin | ||
$ npm install get-stdin | ||
``` | ||
@@ -38,3 +38,3 @@ | ||
Get `stdin` as a string. | ||
Get `stdin` as a `string`. | ||
@@ -45,3 +45,3 @@ In a TTY context, a promise that resolves to an empty string is returned. | ||
Get `stdin` as a buffer. | ||
Get `stdin` as a `Buffer`. | ||
@@ -58,2 +58,2 @@ In a TTY context, a promise that resolves to an empty buffer is returned. | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
3503