Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

co-sh

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-sh

Call any program as if it were a function

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

sh

Call any shell command like a function using ES 6 Proxies & Generators.

Use node v5.0.x with --harmony-proxies flag, along with

  • co
  • thunkify
  • co-read

Usage

var co = require('co');
var read = require('co-read');
var sh = require('co-sh');

co(function *(){
  var ls = yield sh.ls();

  var buf;
  while (buf = yield read(ls.stdout)) {
    console.log(buf.toString());
  }

  try {
    yield sh.nonexistingcmd();
  } catch(e){
    console.log(e);
  }
})();

Assuming the above code is in a file called test.js run it using;

node --harmony-proxies test.js

See the examples folder for more

License

MIT

Keywords

FAQs

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

  • 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