Socket
Socket
Sign inDemoInstall

pipe-args

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pipe-args

Adds piped values from stdin to process argv in a transparent way


Version published
Maintainers
1
Install size
22.4 kB
Created

Readme

Source

pipe-args

Build Status

pipe

pipe-args adds support for unix piped arguments to your node CLI apps

pipe-args makes your node CLI apps to fully support unix pipelines, completely out of the box. Require the the pipe-args module and all the piped arguments are added to the process stdin transparently. It also integrates well with popular command line interface/parsers like yarg and commander.js.

Installation

npm install --save pipe-args

Usage

Basic usage:

#!/usr/bin/env node

const pipe = require('pipe-args');
console.log(`The piped arg is ${process.argv[2]}`);
$ echo test | node index.js

$ The piped arg is test

pipe-args plays along with optstrings parsers such as yarg. The following yargs parser code:

#!/usr/bin/env node

const pipe = require('pipe-args');
const yargs = require('yargs')

const cli = yargs.demand(1)

console.log(cli.argv);

parses linux-style piped arguments as expected:

$ echo piped_arg | yargs-cli.js

$ { _: [ 'piped_arg' ], '$0': 'index.js' }

author: gpestana

license: MIT

Keywords

FAQs

Last updated on 10 Mar 2017

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