1 # get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin)
3 > Get [stdin](https://nodejs.org/api/process.html#process_process_stdin) as a string or buffer
9 $ npm install --save get-stdin
17 const getStdin = require('get-stdin');
19 getStdin().then(str => {
26 $ echo unicorns | node example.js
33 Both methods 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.
37 Get `stdin` as a string.
39 In a TTY context, a promise that resolves to an empty string is returned.
43 Get `stdin` as a buffer.
45 In a TTY context, a promise that resolves to an empty buffer is returned.
50 - [get-stream](https://github.com/sindresorhus/get-stream) - Get a stream as a string or buffer
55 MIT © [Sindre Sorhus](http://sindresorhus.com)