Socket
Socket
Sign inDemoInstall

get-stdin

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-stdin

Get stdin as a string or buffer


Version published
Weekly downloads
16M
increased by3.35%
Maintainers
1
Install size
5.44 kB
Created
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 for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your 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