summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-registry-fetch/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-registry-fetch/README.md')
-rw-r--r--deps/npm/node_modules/npm-registry-fetch/README.md93
1 files changed, 77 insertions, 16 deletions
diff --git a/deps/npm/node_modules/npm-registry-fetch/README.md b/deps/npm/node_modules/npm-registry-fetch/README.md
index 4947dc891f..0c3f4f9469 100644
--- a/deps/npm/node_modules/npm-registry-fetch/README.md
+++ b/deps/npm/node_modules/npm-registry-fetch/README.md
@@ -82,27 +82,33 @@ const res = await fetch.json('/-/ping')
console.log(res) // Body parsed as JSON
```
-#### <a name="fetch-opts"></a> `fetch` Options
+#### <a name="fetch-json-stream"></a> `> fetch.json.stream(url, jsonPath, [opts]) -> Stream`
-Fetch options are optional, and can be passed in as either a Map-like object
-(one with a `.get()` method), a plain javascript object, or a
-[`figgy-pudding`](https://npm.im/figgy-pudding) instance.
+Performs a request to a given registry URL and parses the body of the response
+as JSON, with each entry being emitted through the stream.
-##### <a name="opts-auth-token"></a> `opts._authToken`
-
-* Type: String
-* Default: null
+The `jsonPath` argument is a [`JSONStream.parse()`
+path](https://github.com/dominictarr/JSONStream#jsonstreamparsepath), and the
+returned stream (unlike default `JSONStream`s), has a valid
+`Symbol.asyncIterator` implementation.
-Authentication token string.
+For available options, please see the section on [`fetch` options](#fetch-opts).
-Can be scoped to a registry by using a "nerf dart" for that registry. That is:
+##### Example
-```
-{
- '//registry.npmjs.org/:_authToken': 't0k3nH34r'
+```javascript
+console.log('https://npm.im/~zkat has access to the following packages:')
+for await (let {key, value} of fetch.json.stream('/-/user/zkat/package', '$*')) {
+ console.log(`https://npm.im/${key} (perms: ${value})`)
}
```
+#### <a name="fetch-opts"></a> `fetch` Options
+
+Fetch options are optional, and can be passed in as either a Map-like object
+(one with a `.get()` method), a plain javascript object, or a
+[`figgy-pudding`](https://npm.im/figgy-pudding) instance.
+
##### <a name="opts-agent"></a> `opts.agent`
* Type: http.Agent
@@ -229,6 +235,25 @@ packages.
See also [`opts.retry`](#opts-retry) to provide all retry options as a single
object.
+##### <a name="opts-force-auth"></a> `opts.force-auth`
+
+* Alias: `opts.forceAuth`
+* Type: Object
+* Default: null
+
+If present, other auth-related values in `opts` will be completely ignored,
+including `alwaysAuth`, `email`, and `otp`, when calculating auth for a request,
+and the auth details in `opts.forceAuth` will be used instead.
+
+##### <a name="opts-gzip"></a> `opts.gzip`
+
+* Type: Boolean
+* Default: false
+
+If true, `npm-registry-fetch` will set the `Content-Encoding` header to `gzip`
+and use `zlib.gzip()` or `zlib.createGzip()` to gzip-encode
+[`opts.body`](#opts-body).
+
##### <a name="opts-headers"></a> `opts.headers`
* Type: Object
@@ -238,6 +263,16 @@ Additional headers for the outgoing request. This option can also be used to
override headers automatically generated by `npm-registry-fetch`, such as
`Content-Type`.
+##### <a name="opts-ignore-body"></a> `opts.ignore-body`
+
+* Alias: `opts.ignoreBody`
+* Type: Boolean
+* Default: false
+
+If true, the **response body** will be thrown away and `res.body` set to `null`.
+This will prevent dangling response sockets for requests where you don't usually
+care what the response body is.
+
##### <a name="opts-integrity"></a> `opts.integrity`
* Type: String | [SRI object](https://npm.im/ssri)
@@ -301,6 +336,16 @@ See also [`opts.proxy`](#opts-proxy)
Logger object to use for logging operation details. Must have the same methods
as `npmlog`.
+##### <a name="opts-map-json"></a> `opts.map-json`
+
+* Alias: `mapJson`, `mapJSON`
+* Type: Function
+* Default: undefined
+
+When using `fetch.json.stream()` (NOT `fetch.json()`), this will be passed down
+to [`JSONStream`](https://npm.im/JSONStream) as the second argument to
+`JSONStream.parse`, and can be used to transform stream data before output.
+
##### <a name="opts-maxsockets"></a> `opts.maxsockets`
* Alias: `opts.max-sockets`
@@ -362,7 +407,7 @@ account.
* Default: null
Password used for basic authentication. For the more modern authentication
-method, please use the (more secure) [`opts._authToken`](#opts-auth-token)
+method, please use the (more secure) [`opts.token`](#opts-token)
Can optionally be scoped to a registry by using a "nerf dart" for that registry.
That is:
@@ -513,6 +558,22 @@ See also [`opts.ca`](#opts-ca).
Time before a hanging request times out.
+##### <a name="opts-token"></a> `opts.token`
+
+* Alias: `opts._authToken`
+* Type: String
+* Default: null
+
+Authentication token string.
+
+Can be scoped to a registry by using a "nerf dart" for that registry. That is:
+
+```
+{
+ '//registry.npmjs.org/:token': 't0k3nH34r'
+}
+```
+
##### <a name="opts-user-agent"></a> `opts.user-agent`
* Type: String
@@ -526,7 +587,7 @@ User agent string to send in the `User-Agent` header.
* Default: null
Username used for basic authentication. For the more modern authentication
-method, please use the (more secure) [`opts._authToken`](#opts-auth-token)
+method, please use the (more secure) [`opts.token`](#opts-token)
Can optionally be scoped to a registry by using a "nerf dart" for that registry.
That is:
@@ -545,4 +606,4 @@ See also [`opts.password`](#opts-password)
* Default: null
** DEPRECATED ** This is a legacy authentication token supported only for
-*compatibility. Please us [`opts._authToken`](#opts-auth-token) instead.
+*compatibility. Please use [`opts.token`](#opts-token) instead.