You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sindre Sorhus
63d4a48d11
|
9 years ago | |
---|---|---|
.editorconfig | 9 years ago | |
.gitattributes | 11 years ago | |
.gitignore | 11 years ago | |
.travis.yml | 9 years ago | |
index.js | 9 years ago | |
license | 10 years ago | |
package.json | 9 years ago | |
readme.md | 9 years ago | |
test-real.js | 9 years ago | |
test.js | 9 years ago |
readme.md
get-stdin
Get stdin as a string or buffer
Install
$ npm install --save get-stdin
Usage
// example.js
const stdin = require('get-stdin');
stdin().then(x => {
console.log(x);
//=> 'unicorns'
});
$ echo unicorns | node example.js
unicorns
API
stdin()
Get stdin
as a string.
Returns a promise that is resolved when the 'end' event fires on the stdin
stream, indicating that there is no more data to be read.
In a TTY context, a promise that resolves to an empty string is returned.
stdin.buffer()
Get stdin
as a buffer.
Returns a promise that is resolved when the 'end' event fires on the stdin
stream, indicating that there is no more data to be read.
In a TTY context, a promise that resolves to an empty buffer is returned.
License
MIT © Sindre Sorhus