package-version
Version:
package-version
32 lines (24 loc) • 904 B
Markdown
[](http://badge.fury.io/js/package-version)
[](https://travis-ci.org/kaelzhang/node-package-version)
[](https://gemnasium.com/kaelzhang/node-package-version)
# package-version
Get the version of a package from package.json
## Installation
```bash
npm install package-version --save
```
## version(cwd, callback);
```js
var version = require('package-version');
version('/path/to', function(err, version){
if(err){
console.log('error:', err.stack);
return;
}
console.log('version:', version);
});
```
- cwd `path` the directory of the package
- callback `function(err, version)`
- err `Error`
- version [`semver`](http://www.npmjs.org/package/semver)