Socket
Socket
Sign inDemoInstall

get-stdin

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

get-stdin

Get stdin as a string or buffer

    9.0.0latest
    GitHub
    npm

Version published
Maintainers
1
Weekly downloads
15,456,289
increased by3.04%

Weekly downloads

Package description

What is get-stdin?

The get-stdin package is a simple utility that allows you to easily read stdin as a string or buffer in Node.js. It's useful for command-line tools that need to process input piped to them from the command line.

What are get-stdin's main functionalities?

Read stdin as a string

This feature allows you to read the standard input (stdin) as a string. It returns a promise that resolves with the entire input when the stdin stream ends.

const getStdin = require('get-stdin');

getStdin().then(input => {
  console.log(input);
});

Read stdin as a buffer

This feature allows you to read the standard input (stdin) as a buffer. It returns a promise that resolves with the entire input as a buffer when the stdin stream ends.

const getStdin = require('get-stdin');

getStdin.buffer().then(input => {
  console.log(input);
});

Other packages similar to get-stdin

Readme

Source

get-stdin

Get stdin as a string or buffer

Install

$ npm install get-stdin

Usage

// example.js
import getStdin from 'get-stdin';

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.

  • get-stream - Get a stream as a string or buffer

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.

Keywords

FAQs

Last updated on 16 Apr 2021

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc