Socket
Socket
Sign inDemoInstall

@stdlib/streams-node-stdin

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/streams-node-stdin

Standard input.


Version published
Weekly downloads
327K
decreased by-20.12%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/streams-node-stdin?

@stdlib/streams-node-stdin is a package that provides utilities for working with standard input (stdin) streams in Node.js. It allows you to read data from stdin in various ways, making it easier to handle input in command-line applications.

What are @stdlib/streams-node-stdin's main functionalities?

Read entire stdin as a string

This feature allows you to read the entire stdin input as a single string. The callback function receives the data once it has been fully read.

const stdin = require('@stdlib/streams-node-stdin');

stdin(function (error, data) {
  if (error) {
    console.error('Error reading stdin:', error);
    return;
  }
  console.log('Data:', data);
});

Read stdin line-by-line

This feature allows you to read stdin input line-by-line. Each line is emitted as a 'data' event, making it easy to process input incrementally.

const stdin = require('@stdlib/streams-node-stdin');

stdin.lineStream().on('data', function (line) {
  console.log('Line:', line);
});

Read stdin as a stream

This feature allows you to read stdin as a stream of data chunks. Each chunk is emitted as a 'data' event, which can be useful for processing large inputs incrementally.

const stdin = require('@stdlib/streams-node-stdin');

const stream = stdin.stream();
stream.on('data', function (chunk) {
  console.log('Chunk:', chunk.toString());
});

Other packages similar to @stdlib/streams-node-stdin

Keywords

FAQs

Package last updated on 26 Jul 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc