summaryrefslogtreecommitdiff
path: root/node_modules/get-stdin/index.d.ts
blob: c2a060513bd2e148aec2739f4aabbbbdec312bb6 (plain) (blame)
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
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 from 'get-stdin';

	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 default getStdin;