Created
March 16, 2012 19:35
-
-
Save geddski/2052081 to your computer and use it in GitHub Desktop.
test programmatic npm install
This file contains 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'); | |
npmInstall(['http://dl.dropbox.com/u/3098507/sample.tar.gz'], function () { | |
console.log('yay'); | |
}); | |
/* | |
programmatically install some libs with npm | |
working in OSX but not windows | |
*/ | |
function npmInstall(libs, callback){ | |
npm.load({}, function (er) { | |
if (er) throw new Error(er); | |
npm.commands.install(libs, function (er, data) { | |
if (er) throw new Error(er); | |
callback.call(this); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment