diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-06-06 08:34:31 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-06-13 23:44:43 +0400 |
commit | bb369f71a2fc4ba1c1fbfc3da41a4b1d11becca2 (patch) | |
tree | 5aa01a3635b911b6ebf671d3bec4878157373138 /node_modules/npm-registry-client/README.md | |
parent | 1c2938189122c0640b9403746a6bfed4d6142b27 (diff) |
upgrade to npm-registry-client@2.0.0
Diffstat (limited to 'node_modules/npm-registry-client/README.md')
-rw-r--r-- | node_modules/npm-registry-client/README.md | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/node_modules/npm-registry-client/README.md b/node_modules/npm-registry-client/README.md index 4b3d4c3c6..b8f212e85 100644 --- a/node_modules/npm-registry-client/README.md +++ b/node_modules/npm-registry-client/README.md @@ -18,6 +18,15 @@ client.get("npm", "latest", 1000, function (er, data, raw, res) { }) ``` +# Registry URLs + +The registry calls take either a full URL pointing to a resource in the +registry, or a base URL for the registry as a whole (for the base URL, any path +will be ignored). In addition to `http` and `https`, `npm` URLs are allowed. +`npm` URLs are `https` URLs with the additional restrictions that they will +always include authorization credentials, and the response is always registry +metadata (and not tarballs or other attachments). + # Configuration This program is designed to work with @@ -26,7 +35,6 @@ a plain-jane object with the appropriate configs, and it'll shim it for you. Any configuration thingie that has get/set/del methods will also be accepted. -* `registry` **Required** {String} URL to the registry * `cache` **Required** {String} Path to the cache folder * `always-auth` {Boolean} Auth even for GET requests. * `auth` {String} A base64-encoded `username:password` @@ -59,25 +67,27 @@ also be accepted. * `_token` {Object} A token for use with [couch-login](https://npmjs.org/package/couch-login) -# client.request(method, where, [what], [etag], [nofollow], cb) +# client.request(method, uri, options, cb) * `method` {String} HTTP method -* `where` {String} Path to request on the server -* `what` {Stream | Buffer | String | Object} The request body. Objects - that are not Buffers or Streams are encoded as JSON. -* `etag` {String} The cached ETag -* `nofollow` {Boolean} Prevent following 302/301 responses +* `uri` {String} URI pointing to the resource to request +* `options` {Object} Object containing optional per-request properties. + * `what` {Stream | Buffer | String | Object} The request body. Objects + that are not Buffers or Streams are encoded as JSON. + * `etag` {String} The cached ETag + * `follow` {Boolean} Follow 302/301 responses (defaults to true) * `cb` {Function} * `error` {Error | null} * `data` {Object} the parsed data object * `raw` {String} the json * `res` {Response Object} response from couch -Make a request to the registry. All the other methods are wrappers -around this. one. +Make a request to the registry. All the other methods are wrappers around +`request`. -# client.adduser(username, password, email, cb) +# client.adduser(base, username, password, email, cb) +* `base` {String} Base registry URL * `username` {String} * `password` {String} * `email` {String} @@ -85,88 +95,88 @@ around this. one. Add a user account to the registry, or verify the credentials. -# client.deprecate(name, version, message, cb) +# client.deprecate(uri, version, message, cb) -* `name` {String} The package name +* `uri` {String} Full registry URI for the deprecated package * `version` {String} Semver version range * `message` {String} The message to use as a deprecation warning * `cb` {Function} Deprecate a version of a package in the registry. -# client.bugs(name, cb) +# client.bugs(uri, cb) -* `name` {String} the name of the package +* `uri` {String} Full registry URI for the package * `cb` {Function} Get the url for bugs of a package -# client.get(url, [timeout], [nofollow], [staleOk], cb) +# client.get(uri, options, cb) -* `url` {String} The url path to fetch -* `timeout` {Number} Number of seconds old that a cached copy must be - before a new request will be made. -* `nofollow` {Boolean} Do not follow 301/302 responses -* `staleOk` {Boolean} If there's cached data available, then return that - to the callback quickly, and update the cache the background. +* `uri` {String} The complete registry URI to fetch +* `options` {Object} Object containing optional per-request properties. + * `timeout` {Number} Duration before the request times out. + * `follow` {Boolean} Follow 302/301 responses (defaults to true) + * `staleOk` {Boolean} If there's cached data available, then return that + to the callback quickly, and update the cache the background. -Fetches data from the registry via a GET request, saving it in -the cache folder with the ETag. +Fetches data from the registry via a GET request, saving it in the cache folder +with the ETag. -# client.publish(data, tarball, cb) +# client.publish(uri, data, tarball, cb) +* `uri` {String} The registry URI to publish to * `data` {Object} Package data * `tarball` {String | Stream} Filename or stream of the package tarball * `cb` {Function} Publish a package to the registry. -Note that this does not create the tarball from a folder. However, it -can accept a gzipped tar stream or a filename to a tarball. +Note that this does not create the tarball from a folder. However, it can +accept a gzipped tar stream or a filename to a tarball. -# client.star(package, starred, cb) +# client.star(uri, starred, cb) -* `package` {String} Name of the package to star +* `uri` {String} The complete registry URI to star * `starred` {Boolean} True to star the package, false to unstar it. * `cb` {Function} Star or unstar a package. -Note that the user does not have to be the package owner to star or -unstar a package, though other writes do require that the user be the -package owner. +Note that the user does not have to be the package owner to star or unstar a +package, though other writes do require that the user be the package owner. -# client.stars(username, cb) +# client.stars(base, username, cb) +* `base` {String} The base URL for the registry * `username` {String} Name of user to fetch starred packages for. * `cb` {Function} View your own or another user's starred packages. -# client.tag(project, version, tag, cb) +# client.tag(uri, version, tag, cb) -* `project` {String} Project name +* `uri` {String} The complete registry URI to tag * `version` {String} Version to tag * `tag` {String} Tag name to apply * `cb` {Function} -Mark a version in the `dist-tags` hash, so that `pkg@tag` -will fetch the specified version. +Mark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the +specified version. -# client.unpublish(name, [ver], cb) +# client.unpublish(uri, [ver], cb) -* `name` {String} package name +* `uri` {String} The complete registry URI to unpublish * `ver` {String} version to unpublish. Leave blank to unpublish all versions. * `cb` {Function} -Remove a version of a package (or all versions) from the registry. When -the last version us unpublished, the entire document is removed from the -database. +Remove a version of a package (or all versions) from the registry. When the +last version us unpublished, the entire document is removed from the database. -# client.upload(where, file, [etag], [nofollow], cb) +# client.upload(uri, file, [etag], [nofollow], cb) -* `where` {String} URL path to upload to +* `uri` {String} The complete registry URI to upload to * `file` {String | Stream} Either the filename or a readable stream * `etag` {String} Cache ETag * `nofollow` {Boolean} Do not follow 301/302 responses |