我为你做了一个小调查。
有两种方法可以用 yeoman 下载东西...
/**
* Download a string or an array of files to a given destination.
*
* @param {String|Array} url
* @param {String} destination
* @param {Function} cb
*/
this.fetch(url, destination, cb)
/**
* Fetch a string or an array of archives and extract it/them to a given
* destination.
*
* @param {String|Array} archive
* @param {String} destination
* @param {Function} cb
*/
this.extract(archive, destination, cb)
如果出现问题,回调将传递错误。
还有一种从 Github 下载包的方法。
/**
* Remotely fetch a package from github (or an archive), store this into a _cache
* folder, and provide a "remote" object as a facade API to ourself (part of
* generator API, copy, template, directory). It's possible to remove local cache,
* and force a new remote fetch of the package.
*
* ### Examples:
*
* this.remote('user', 'repo', function(err, remote) {
* remote.copy('.', 'vendors/user-repo');
* });
*
* this.remote('user', 'repo', 'branch', function(err, remote) {
* remote.copy('.', 'vendors/user-repo');
* });
*
* this.remote('http://foo.com/bar.zip', function(err, remote) {
* remote.copy('.', 'vendors/user-repo');
* });
*
* When fetching from Github
* @param {String} username
* @param {String} repo
* @param {String} branch
* @param {Function} cb
* @param {Boolean} refresh
*
* @also
* When fetching an archive
* @param {String} url
* @param {Function} cb
* @param {Boolean} refresh
*/