You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@stdlib/process-read-stdin

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/process-read-stdin

Read data from stdin.

0.2.2
latest
Source
npmnpm
Version published
Weekly downloads
339K
1.82%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/process-read-stdin?

@stdlib/process-read-stdin is a Node.js package that provides utilities for reading from the standard input (stdin) stream. It is particularly useful for command-line applications and scripts that need to process input provided by the user or piped from other commands.

What are @stdlib/process-read-stdin's main functionalities?

Read Entire Input

This feature allows you to read the entire input from stdin at once. The callback function receives any error that occurred and the data read from stdin.

const stdin = require('@stdlib/process-read-stdin');

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

Read Input Line by Line

This feature allows you to read the input from stdin and process it line by line. The input data is split into lines, and each line is processed individually.

const stdin = require('@stdlib/process-read-stdin');

stdin(function (error, data) {
  if (error) {
    console.error('Error reading stdin:', error);
    return;
  }
  const lines = data.toString().split('\n');
  lines.forEach((line, index) => {
    console.log(`Line ${index + 1}: ${line}`);
  });
});

Other packages similar to @stdlib/process-read-stdin

Keywords

stdlib

FAQs

Package last updated on 27 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.