get-stdin
Get stdin as a string or buffer
Last updated 17 days ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install get-stdin 
SYNC missed versions from official npm registry.

get-stdin Build Status

Get stdin as a string or buffer

Install

$ npm install get-stdin

Usage

// example.js
const getStdin = require('get-stdin');

(async () => {
	console.log(await getStdin());
	//=> 'unicorns'
})();
$ echo unicorns | node example.js
unicorns

API

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.

getStdin()

Get stdin as a string.

In a TTY context, a promise that resolves to an empty string is returned.

getStdin.buffer()

Get stdin as a Buffer.

In a TTY context, a promise that resolves to an empty Buffer is returned.

Related


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Current Tags

  • 8.0.0                                ...           latest (17 days ago)

13 Versions

  • 8.0.0                                ...           17 days ago
  • 7.0.0                                ...           a year ago
  • 6.0.0                                ...           2 years ago
  • 5.0.1                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.0.1                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.2                                ...           6 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 4,334
This Week 147,087
This Month 733,095
Last Day 36,593
Last Week 190,512
Last Month 794,867
Dependencies (0)
None
Dev Dependencies (5)
Dependents (978)

Copyright 2014 - 2016 © taobao.org |