get-package

2019-08-14 admin

get-package是什么

什么是get-package,Get package.json from disk/npm depending on the path

get-package使用教程帮助文档

get-package Build Status

Get package.json from disk/npm depending on the path/name

Install

$ npm install --save get-package

Usage

var getPackage = require('get-package')

getPackage('xtend', callback)
//=> gets latest xtend package.json from npm

getPackage('./node_modules/xtend', callback)
//=> gets package.json from xtend on disk

API

getPackage(name, [options], callback) -> undefined

name

Required Type: string

A valid package name or path. Relative paths must begin with a . to be detected.

options
version

Type: string Default: latest

The version to fetch. If the local version does not match, npm will be queried even when name is a local path.

cwd

Type: string Default: process.cwd()

callback

Required Type: function Arguments: err, json

A callback that will receive the parsed JSON of the package.

License

MIT © Ben Drucker

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-72485.html

文章标题:get-package

回到顶部