A npm wrapper for programming
You may install this module with this command:
npm install npmw --save
npm
has no support for multi registries yet. npmw
is a design wrapper for programming, including some frequent utility methods
npmw(options).<command>(arguments);
new npmw(options).<command>(arguments);
Type: string
Default: 'http://registry.npmjs.org'
NPM registry server. Useful if you use your private npm server.
Notice that, npm
doesn't support connecting multiple servers simultaneously.
You can use all npm.commands
method with npmw().<command>()
. Besides, there're other useful methods:
callback
has two arguments error
, data
Type: Object
data.exists: boolean
whether module <name>@<version>
is exists
data.versions: Array.<string>
available versions
data.latest: string
latest version
data.data: Object
original server data
var npmw = require('npmw');
var npm = npmw({
registry: 'http://registry.yourserver.local'
});
npm.exists('npmw', '~0.0.0', function(error, data){
if(!error && data.exists){
console.log('Module npmw@~0.0.0 exists and the latest version is "' + data.latest + '"');
}
});