Created
March 16, 2011 01:56
-
-
Save dmcquay/871869 to your computer and use it in GitHub Desktop.
programatically execute npm view command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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