Socket
Book a DemoInstallSign in
Socket

cmd-fn

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmd-fn

Execute any node module function from the command line.

latest
Source
npmnpm
Version
1.2.2
Version published
Maintainers
1
Created
Source

cmd-fn

Execute any node module function from the command line.

Installation

npm install -g cmd-fn

Usage

Usage: cmd-fn [options]

Options:

  -h, --help                output usage information
  -m, --module [name]       module name e.g.: `fs`
  -f, --function [name]     function name
  -c, --cwd [path]          working directory context to run function from
  -p, --params [arguments]  function arguments specified as an array e.g.: `'["foo", "bar"]'`
  --promise                 function is async and uses promises
  --node-callback           function is async with a node-style callback

Example:

  To execute the following node function `fs.readdirSync("/var/tmp")`, you would do:
  $ cmd-fn --module fs --function readdirSync --params '["/var/tmp"]'

  To do an async call like `http.get({"hostname":"www.google.com"}, cb)`:
  $ cmd-fn --module http --function get --params '[{"hostname":"www.google.com"}]' --node-callback

Author

Dave Jeffery (@DaveJ)

FAQs

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

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.