get-stdin
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Get-stdin is an npm package that assists developers in retrieving stdin as a string or a buffer. 'stdin' stands for Standard Input, a fundamental concept in Node.js for receiving input data. Under the hood, get-stdin generates a promise that resolves when the 'end' event triggers on the 'stdin' data stream, indicating that all incoming data has been read.
Leveraging get-stdin in your Node.js project is a straightforward process. First, you need to install the npm package with $ npm install get-stdin
. Once installed, you can use the module in your Javascript file. Here's an example of how to import and use get-stdin:
// Import the module
import getStdin from 'get-stdin';
// Use getStdin to capture stdin data
console.log(await getStdin());
In a Terminal or Command Prompt, you can pipe some data to your JS file and observe get-stdin in action:
$ echo unicorns | node example.js
// Outputs: unicorns
If you are working in a TTY context, both methods (getStdin() and getStdin.buffer()) will return a promise that resolves to an empty string or an empty Buffer respectively.
You can find the complete documentation and usage of get-stdin within its GitHub repository at git+https://github.com/sindresorhus/get-stdin.git. Beyond the basic usage and API documentation, the README also informs on related npm packages, and provides details on professional support for this package via Tidelift subscription.