File: index.d.ts

package info (click to toggle)
node-get-stdin 8.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 164 kB
  • sloc: javascript: 136; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 905 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/// <reference types="node"/>

declare const getStdin: {
	/**
	Get [`stdin`](https://nodejs.org/api/process.html#process_process_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, an empty `string` is returned.

	@example
	```
	// example.ts
	import getStdin = require('get-stdin');

	(async () => {
		console.log(await getStdin());
		//=> 'unicorns'
	})

	// $ echo unicorns | ts-node example.ts
	// unicorns
	```
	*/
	(): Promise<string>;

	/**
	Get [`stdin`](https://nodejs.org/api/process.html#process_process_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, an empty `Buffer` is returned.
	*/
	buffer(): Promise<Buffer>;
};

export = getStdin;