Skip to content

Instantly share code, notes, and snippets.

@dmcquay
Created March 16, 2011 01:56
Show Gist options
  • Save dmcquay/871869 to your computer and use it in GitHub Desktop.
Save dmcquay/871869 to your computer and use it in GitHub Desktop.
programatically execute npm view command
var npm = require('npm'),
stream = require('stream');
cmdOutStream = new stream.WriteableStream();
cmdOutStream.on('data', function(data) {
console.log('found some data: ' + data);
});
cmdOutStream.on('end', function() {
console.log('found end');
});
cmdOutStream.on('error', function(err) {
console.log('crap, there was an error');
});
npm.load({outfd:cmdOutStream}, function(er) {
npm.commands.view(['gracie', 'scripts.test'], function(arg) {
console.log('my callback got called');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment