New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cli-pipe

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-pipe

Accept piped data as an argument to your CLI app

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

cli-pipe

Accept piped data as an argument to your CLI app

This module allows you to accept piped data in your application along with directly provided arguments. It returns a simple array of all the arguments and flags, with any piped data pushed onto the end of the array.

Usage

First, install with npm:

$ npm install cli-pipe

Then include and call:

// File: test.js
var get_args = require('cli-pipe');

get_args(function (args) {
  console.log(args);
});

Run it like so:

$ node test.js first second    # Arguments provided directly
[ 'node', '/path/to/dir/test.js', 'first', 'second' ]

$ cat somefile.txt | node test.js first   # Piped data and direct args
[ 'node', '/path/to/dir/test.js', 'first', 'content of somefile.txt' ]

This module does not alter process.argv, so it is compatible with most or all other CLI helper modules (e.g. commander, meow).

Keywords

cli

FAQs

Package last updated on 26 Aug 2015

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