\href{https://github.com/npm/npm-registry-fetch}{\texttt{ {\ttfamily npm-\/registry-\/fetch}}} is a Node.\+js library that implements a {\ttfamily fetch}-\/like API for accessing npm registry APIs consistently. It\textquotesingle{}s able to consume npm-\/style configuration values and has all the necessary logic for picking registries, handling scopes, and dealing with authentication details built-\/in.

This package is meant to replace the older \href{https://npm.im/npm-registry-client}{\texttt{ {\ttfamily npm-\/registry-\/client}}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18674}{}\doxysection{Example}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18674}

\begin{DoxyCode}{0}
\DoxyCodeLine{const npmFetch = require('npm-\/registry-\/fetch')}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(}
\DoxyCodeLine{  await npmFetch.json('/-\//ping')}
\DoxyCodeLine{) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18675}{}\doxysection{Table of Contents}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18675}

\begin{DoxyItemize}
\item \href{\#install}{\texttt{ Installing}}
\item \href{\#example}{\texttt{ Example}}
\item \href{\#contributing}{\texttt{ Contributing}}
\item \href{\#api}{\texttt{ API}}
\begin{DoxyItemize}
\item \href{\#fetch}{\texttt{ {\ttfamily fetch}}}
\item \href{\#fetch-json}{\texttt{ {\ttfamily fetch.\+json}}}
\item \href{\#fetch-opts}{\texttt{ {\ttfamily fetch} options}}
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18676}{}\doxysubsection{Install}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18676}
{\ttfamily \$ npm install npm-\/registry-\/fetch}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18677}{}\doxysubsection{Contributing}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18677}
The npm team enthusiastically welcomes contributions and project participation! There\textquotesingle{}s a bunch of things you can do if you want to contribute! The ContributorGuide"{} has all the information you need for everything from reporting bugs to contributing entire new features. Please don\textquotesingle{}t hesitate to jump in if you\textquotesingle{}d like to, or even ask us questions if something isn\textquotesingle{}t clear.

All participants and maintainers in this project are expected to follow Code ofConduct"{}, and just generally be excellent to each other.

Please refer to the \mbox{\hyperlink{md_sfcode_node_modules_npm_registry_fetch_CHANGELOG}{Changelog}} for project history details, too.

Happy hacking!\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18678}{}\doxysubsection{API}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18678}
\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18679}{}\doxysubsubsection{Caching and $<$tt$>$write=true$<$/tt$>$ query strings}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18679}
Before performing any PUT or DELETE operation, npm clients first make a GET request to the registry resource being updated, which includes the query string {\ttfamily ?write=true}.

The semantics of this are, effectively, "{}I intend to write to this thing, and need to know the latest current value, so that my write can land cleanly"{}.

The public npm registry handles these {\ttfamily ?write=true} requests by ensuring that the cache is re-\/validated before sending a response. In order to maintain the same behavior on the client, and not get tripped up by an overeager local cache when we intend to write data to the registry, any request that comes through {\ttfamily npm-\/registry-\/fetch} that contains {\ttfamily write=true} in the query string will forcibly set the {\ttfamily prefer-\/online} option to {\ttfamily true}, and set both {\ttfamily prefer-\/offline} and {\ttfamily offline} to false, so that any local cached value will be revalidated.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18680}{}\doxysubsubsection{$<$a name=\char`\"{}fetch\char`\"{}$>$$<$/a$>$ $<$tt$>$$>$ fetch(url, \mbox{[}opts\mbox{]}) -\/$>$ Promise$<$\+Response$>$$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18680}
Performs a request to a given URL.

The URL can be either a full URL, or a path to one. The appropriate registry will be automatically picked if only a URL path is given.

For available options, please see the section on \href{\#fetch-opts}{\texttt{ {\ttfamily fetch} options}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18681}{}\doxyparagraph{Example}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18681}

\begin{DoxyCode}{0}
\DoxyCodeLine{const res = await fetch('/-\//ping')}
\DoxyCodeLine{console.log(res.headers)}
\DoxyCodeLine{res.on('data', d => console.log(d.toString('utf8'))) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18682}{}\doxysubsubsection{$<$a name=\char`\"{}fetch-\/json\char`\"{}$>$$<$/a$>$ $<$tt$>$$>$ fetch.\+json(url, \mbox{[}opts\mbox{]}) -\/$>$ Promise$<$\+Response\+JSON$>$$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18682}
Performs a request to a given registry URL, parses the body of the response as JSON, and returns it as its final value. This is a utility shorthand for {\ttfamily fetch(url).then(res =$>$ res.\+json())}.

For available options, please see the section on \href{\#fetch-opts}{\texttt{ {\ttfamily fetch} options}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18683}{}\doxyparagraph{Example}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18683}

\begin{DoxyCode}{0}
\DoxyCodeLine{const res = await fetch.json('/-\//ping')}
\DoxyCodeLine{console.log(res) // Body parsed as JSON }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18684}{}\doxysubsubsection{$<$a name=\char`\"{}fetch-\/json-\/stream\char`\"{}$>$$<$/a$>$ $<$tt$>$$>$ fetch.\+json.\+stream(url, json\+Path, \mbox{[}opts\mbox{]}) -\/$>$ Stream$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18684}
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.

The {\ttfamily json\+Path} argument is a \href{https://github.com/dominictarr/JSONStream\#jsonstreamparsepath}{\texttt{ {\ttfamily JSONStream.\+parse()} path}}, and the returned stream (unlike default {\ttfamily JSONStream}s), has a valid {\ttfamily Symbol.\+async\+Iterator} implementation.

For available options, please see the section on \href{\#fetch-opts}{\texttt{ {\ttfamily fetch} options}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18685}{}\doxyparagraph{Example}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18685}

\begin{DoxyCode}{0}
\DoxyCodeLine{console.log('https://npm.im/\string~zkat has access to the following packages:')}
\DoxyCodeLine{for await (let \{key, value\} of fetch.json.stream('/-\//user/zkat/package', '\$*')) \{}
\DoxyCodeLine{  console.log(`https://npm.im/\$\{key\} (perms: \$\{value\})`)}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18686}{}\doxysubsubsection{$<$a name=\char`\"{}fetch-\/opts\char`\"{}$>$$<$/a$>$ $<$tt$>$fetch$<$/tt$>$ Options}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18686}
Fetch options are optional, and can be passed in as either a Map-\/like object (one with a {\ttfamily .get()} method), a plain javascript object, or a \href{https://npm.im/figgy-pudding}{\texttt{ {\ttfamily figgy-\/pudding}}} instance.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18687}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/agent\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+agent$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18687}

\begin{DoxyItemize}
\item Type\+: http.\+Agent
\item Default\+: an appropriate agent based on URL protocol and proxy settings
\end{DoxyItemize}

An \href{https://nodejs.org/api/http.html\#http_class_http_agent}{\texttt{ {\ttfamily Agent}}} instance to be shared across requests. This allows multiple concurrent {\ttfamily fetch} requests to happen on the same socket.

You do {\itshape not} need to provide this option unless you want something particularly specialized, since proxy configurations and http/https agents are already automatically managed internally when this option is not passed through.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18688}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/body\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+body$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18688}

\begin{DoxyItemize}
\item Type\+: Buffer $\vert$ Stream $\vert$ Object
\item Default\+: null
\end{DoxyItemize}

Request body to send through the outgoing request. Buffers and Streams will be passed through as-\/is, with a default {\ttfamily content-\/type} of {\ttfamily application/octet-\/stream}. Plain Java\+Script objects will be {\ttfamily JSON.\+stringify}ed and the {\ttfamily content-\/type} will default to {\ttfamily application/json}.

Use \href{\#opts-headers}{\texttt{ {\ttfamily opts.\+headers}}} to set the content-\/type to something else.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18689}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/ca\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+ca$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18689}

\begin{DoxyItemize}
\item Type\+: String, Array, or null
\item Default\+: null
\end{DoxyItemize}

The Certificate Authority signing certificate that is trusted for SSL connections to the registry. Values should be in PEM format (Windows calls it \char`\"{}\+Base-\/64 encoded X.\+509 (.\+CER)\char`\"{}) with newlines replaced by the string `'~\newline
\textquotesingle{}\`{}. For example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  ca: '-\/-\/-\/-\/-\/BEGIN CERTIFICATE-\/-\/-\/-\/-\/\(\backslash\)nXXXX\(\backslash\)nXXXX\(\backslash\)n-\/-\/-\/-\/-\/END CERTIFICATE-\/-\/-\/-\/-\/'}
\DoxyCodeLine{\} }

\end{DoxyCode}


Set to {\ttfamily null} to only allow \char`\"{}known\char`\"{} registrars, or to a specific CA cert to trust only that specific signing authority.

Multiple CAs can be trusted by specifying an array of certificates instead of a single string.

See also \href{\#opts-strict-ssl}{\texttt{ {\ttfamily opts.\+strict-\/ssl}}}, \href{\#opts-ca}{\texttt{ {\ttfamily opts.\+ca}}} and \href{\#opts-key}{\texttt{ {\ttfamily opts.\+key}}}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18690}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/cache\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+cache$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18690}

\begin{DoxyItemize}
\item Type\+: path
\item Default\+: null
\end{DoxyItemize}

The location of the http cache directory. If provided, certain cachable requests will be cached according to \href{https://tools.ietf.org/html/rfc7234}{\texttt{ IETF RFC 7234}} rules. This will speed up future requests, as well as make the cached data available offline if necessary/requested.

See also \href{\#opts-offline}{\texttt{ {\ttfamily offline}}}, \href{\#opts-prefer-offline}{\texttt{ {\ttfamily prefer-\/offline}}}, and \href{\#opts-prefer-online}{\texttt{ {\ttfamily prefer-\/online}}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18691}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/cert\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+cert$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18691}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it \char`\"{}\+Base-\/64 encoded X.\+509 (.\+CER)\char`\"{}) with newlines replaced by the string `'~\newline
\textquotesingle{}\`{}. For example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  cert: '-\/-\/-\/-\/-\/BEGIN CERTIFICATE-\/-\/-\/-\/-\/\(\backslash\)nXXXX\(\backslash\)nXXXX\(\backslash\)n-\/-\/-\/-\/-\/END CERTIFICATE-\/-\/-\/-\/-\/'}
\DoxyCodeLine{\} }

\end{DoxyCode}


It is {\itshape not} the path to a certificate file (and there is no \char`\"{}certfile\char`\"{} option).

See also\+: \href{\#opts-ca}{\texttt{ {\ttfamily opts.\+ca}}} and \href{\#opts-key}{\texttt{ {\ttfamily opts.\+key}}}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18692}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/fetch-\/retries\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+fetch-\/retries$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18692}

\begin{DoxyItemize}
\item Type\+: Number
\item Default\+: 2
\end{DoxyItemize}

The \char`\"{}retries\char`\"{} config for \href{https://npm.im/retry}{\texttt{ {\ttfamily retry}}} to use when fetching packages from the registry.

See also \href{\#opts-retry}{\texttt{ {\ttfamily opts.\+retry}}} to provide all retry options as a single object.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18693}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/fetch-\/retry-\/factor\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+fetch-\/retry-\/factor$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18693}

\begin{DoxyItemize}
\item Type\+: Number
\item Default\+: 10
\end{DoxyItemize}

The \char`\"{}factor\char`\"{} config for \href{https://npm.im/retry}{\texttt{ {\ttfamily retry}}} to use when fetching packages.

See also \href{\#opts-retry}{\texttt{ {\ttfamily opts.\+retry}}} to provide all retry options as a single object.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18694}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/fetch-\/retry-\/mintimeout\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+fetch-\/retry-\/mintimeout$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18694}

\begin{DoxyItemize}
\item Type\+: Number
\item Default\+: 10000 (10 seconds)
\end{DoxyItemize}

The \char`\"{}min\+Timeout\char`\"{} config for \href{https://npm.im/retry}{\texttt{ {\ttfamily retry}}} to use when fetching packages.

See also \href{\#opts-retry}{\texttt{ {\ttfamily opts.\+retry}}} to provide all retry options as a single object.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18695}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/fetch-\/retry-\/maxtimeout\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+fetch-\/retry-\/maxtimeout$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18695}

\begin{DoxyItemize}
\item Type\+: Number
\item Default\+: 60000 (1 minute)
\end{DoxyItemize}

The \char`\"{}max\+Timeout\char`\"{} config for \href{https://npm.im/retry}{\texttt{ {\ttfamily retry}}} to use when fetching packages.

See also \href{\#opts-retry}{\texttt{ {\ttfamily opts.\+retry}}} to provide all retry options as a single object.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18696}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/force-\/auth\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+force-\/auth$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18696}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+force\+Auth}
\item Type\+: Object
\item Default\+: null
\end{DoxyItemize}

If present, other auth-\/related values in {\ttfamily opts} will be completely ignored, including {\ttfamily always\+Auth}, {\ttfamily email}, and {\ttfamily otp}, when calculating auth for a request, and the auth details in {\ttfamily opts.\+force\+Auth} will be used instead.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18697}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/gzip\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+gzip$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18697}

\begin{DoxyItemize}
\item Type\+: Boolean
\item Default\+: false
\end{DoxyItemize}

If true, {\ttfamily npm-\/registry-\/fetch} will set the {\ttfamily Content-\/\+Encoding} header to {\ttfamily gzip} and use {\ttfamily zlib.\+gzip()} or {\ttfamily zlib.\+create\+Gzip()} to gzip-\/encode \href{\#opts-body}{\texttt{ {\ttfamily opts.\+body}}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18698}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/headers\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+headers$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18698}

\begin{DoxyItemize}
\item Type\+: Object
\item Default\+: null
\end{DoxyItemize}

Additional headers for the outgoing request. This option can also be used to override headers automatically generated by {\ttfamily npm-\/registry-\/fetch}, such as {\ttfamily Content-\/\+Type}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18699}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/ignore-\/body\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+ignore-\/body$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18699}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+ignore\+Body}
\item Type\+: Boolean
\item Default\+: false
\end{DoxyItemize}

If true, the {\bfseries{response body}} will be thrown away and {\ttfamily res.\+body} set to {\ttfamily null}. This will prevent dangling response sockets for requests where you don\textquotesingle{}t usually care what the response body is.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18700}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/integrity\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+integrity$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18700}

\begin{DoxyItemize}
\item Type\+: String $\vert$ \href{https://npm.im/ssri}{\texttt{ SRI object}}
\item Default\+: null
\end{DoxyItemize}

If provided, the response body\textquotesingle{}s will be verified against this integrity string, using \href{https://npm.im/ssri}{\texttt{ {\ttfamily ssri}}}. If verification succeeds, the response will complete as normal. If verification fails, the response body will error with an {\ttfamily EINTEGRITY} error.

Body integrity is only verified if the body is actually consumed to completion -- that is, if you use {\ttfamily res.\+json()}/{\ttfamily res.\+buffer()}, or if you consume the default {\ttfamily res} stream data to its end.

Cached data will have its integrity automatically verified using the previously-\/generated integrity hash for the saved request information, so {\ttfamily EINTEGRITY} errors can happen if \href{\#opts-cache}{\texttt{ {\ttfamily opts.\+cache}}} is used, even if {\ttfamily opts.\+integrity} is not passed in.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18701}{}\doxyparagraph{$<$a name=\textquotesingle{}opts-\/is-\/from-\/ci\textquotesingle{}$>$$<$/a$>$ $<$tt$>$opts.\+is-\/from-\/ci$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18701}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+is\+From\+CI}
\item Type\+: Boolean
\item Default\+: Based on environment variables
\end{DoxyItemize}

This is used to populate the {\ttfamily npm-\/in-\/ci} request header sent to the registry.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18702}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/key\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+key$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18702}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string `'~\newline
\textquotesingle{}\`{}. For example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  key: '-\/-\/-\/-\/-\/BEGIN PRIVATE KEY-\/-\/-\/-\/-\/\(\backslash\)nXXXX\(\backslash\)nXXXX\(\backslash\)n-\/-\/-\/-\/-\/END PRIVATE KEY-\/-\/-\/-\/-\/'}
\DoxyCodeLine{\} }

\end{DoxyCode}


It is {\itshape not} the path to a key file (and there is no \char`\"{}keyfile\char`\"{} option).

See also\+: \href{\#opts-ca}{\texttt{ {\ttfamily opts.\+ca}}} and \href{\#opts-cert}{\texttt{ {\ttfamily opts.\+cert}}}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18703}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/local-\/address\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+local-\/address$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18703}

\begin{DoxyItemize}
\item Type\+: IP Address String
\item Default\+: null
\end{DoxyItemize}

The IP address of the local interface to use when making connections to the registry.

See also \href{\#opts-proxy}{\texttt{ {\ttfamily opts.\+proxy}}}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18704}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/log\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+log$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18704}

\begin{DoxyItemize}
\item Type\+: \href{https://npm.im/npmlog}{\texttt{ {\ttfamily npmlog}}}-\/like
\item Default\+: null
\end{DoxyItemize}

Logger object to use for logging operation details. Must have the same methods as {\ttfamily npmlog}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18705}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/map-\/json\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+map-\/json$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18705}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily map\+Json}, {\ttfamily map\+JSON}
\item Type\+: Function
\item Default\+: undefined
\end{DoxyItemize}

When using {\ttfamily fetch.\+json.\+stream()} (NOT {\ttfamily fetch.\+json()}), this will be passed down to \href{https://npm.im/JSONStream}{\texttt{ {\ttfamily JSONStream}}} as the second argument to {\ttfamily JSONStream.\+parse}, and can be used to transform stream data before output.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18706}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/maxsockets\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+maxsockets$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18706}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+max-\/sockets}
\item Type\+: Integer
\item Default\+: 12
\end{DoxyItemize}

Maximum number of sockets to keep open during requests. Has no effect if \href{\#opts-agent}{\texttt{ {\ttfamily opts.\+agent}}} is used.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18707}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/method\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+method$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18707}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: \textquotesingle{}GET\textquotesingle{}
\end{DoxyItemize}

HTTP method to use for the outgoing request. Case-\/insensitive.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18708}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/noproxy\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+noproxy$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18708}

\begin{DoxyItemize}
\item Type\+: Boolean
\item Default\+: process.\+env.\+NOPROXY
\end{DoxyItemize}

If true, proxying will be disabled even if \href{\#opts-proxy}{\texttt{ {\ttfamily opts.\+proxy}}} is used.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18709}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/npm-\/session\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+npm-\/session$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18709}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+npm\+Session}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

If provided, will be sent in the {\ttfamily npm-\/session} header. This header is used by the npm registry to identify individual user sessions (usually individual invocations of the CLI).\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18710}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/offline\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+offline$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18710}

\begin{DoxyItemize}
\item Type\+: Boolean
\item Default\+: false
\end{DoxyItemize}

Force offline mode\+: no network requests will be done during install. To allow {\ttfamily npm-\/registry-\/fetch} to fill in missing cache data, see \href{\#opts-prefer-offline}{\texttt{ {\ttfamily opts.\+prefer-\/offline}}}.

This option is only really useful if you\textquotesingle{}re also using \href{\#opts-cache}{\texttt{ {\ttfamily opts.\+cache}}}.

This option is set to {\ttfamily true} when the request includes {\ttfamily write=true} in the query string.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18711}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/otp\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+otp$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18711}

\begin{DoxyItemize}
\item Type\+: Number $\vert$ String
\item Default\+: null
\end{DoxyItemize}

This is a one-\/time password from a two-\/factor authenticator. It is required for certain registry interactions when two-\/factor auth is enabled for a user account.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18712}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/password\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+password$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18712}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily \+\_\+password}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

Password used for basic authentication. For the more modern authentication method, please use the (more secure) \href{\#opts-token}{\texttt{ {\ttfamily opts.\+token}}}

Can optionally be scoped to a registry by using a \char`\"{}nerf dart\char`\"{} for that registry. That is\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  '//registry.npmjs.org/:password': 't0k3nH34r'}
\DoxyCodeLine{\} }

\end{DoxyCode}


See also \href{\#opts-username}{\texttt{ {\ttfamily opts.\+username}}}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18713}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/prefer-\/offline\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+prefer-\/offline$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18713}

\begin{DoxyItemize}
\item Type\+: Boolean
\item Default\+: false
\end{DoxyItemize}

If true, staleness checks for cached data will be bypassed, but missing data will be requested from the server. To force full offline mode, use \href{\#opts-offline}{\texttt{ {\ttfamily opts.\+offline}}}.

This option is generally only useful if you\textquotesingle{}re also using \href{\#opts-cache}{\texttt{ {\ttfamily opts.\+cache}}}.

This option is set to {\ttfamily false} when the request includes {\ttfamily write=true} in the query string.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18714}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/prefer-\/online\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+prefer-\/online$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18714}

\begin{DoxyItemize}
\item Type\+: Boolean
\item Default\+: false
\end{DoxyItemize}

If true, staleness checks for cached data will be forced, making the CLI look for updates immediately even for fresh package data.

This option is generally only useful if you\textquotesingle{}re also using \href{\#opts-cache}{\texttt{ {\ttfamily opts.\+cache}}}.

This option is set to {\ttfamily true} when the request includes {\ttfamily write=true} in the query string.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18715}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/project-\/scope\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+project-\/scope$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18715}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+project\+Scope}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

If provided, will be sent in the {\ttfamily npm-\/scope} header. This header is used by the npm registry to identify the toplevel package scope that a particular project installation is using.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18716}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/proxy\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+proxy$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18716}

\begin{DoxyItemize}
\item Type\+: url
\item Default\+: null
\end{DoxyItemize}

A proxy to use for outgoing http requests. If not passed in, the {\ttfamily HTTP(\+S)\+\_\+\+PROXY} environment variable will be used.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18717}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/query\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+query$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18717}

\begin{DoxyItemize}
\item Type\+: String $\vert$ Object
\item Default\+: null
\end{DoxyItemize}

If provided, the request URI will have a query string appended to it using this query. If {\ttfamily opts.\+query} is an object, it will be converted to a query string using \href{https://nodejs.org/api/querystring.html\#querystring_querystring_stringify_obj_sep_eq_options}{\texttt{ {\ttfamily querystring.\+stringify()}}}.

If the request URI already has a query string, it will be merged with {\ttfamily opts.\+query}, preferring {\ttfamily opts.\+query} values.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18718}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/refer\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+refer$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18718}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+referer}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

Value to use for the {\ttfamily Referer} header. The npm CLI itself uses this to serialize the npm command line using the given request.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18719}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/registry\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+registry$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18719}

\begin{DoxyItemize}
\item Type\+: URL
\item Default\+: `\textquotesingle{}\href{https://registry.npmjs.org&rsquo;}{\texttt{ https\+://registry.\+npmjs.\+org'}}\`{}
\end{DoxyItemize}

Registry configuration for a request. If a request URL only includes the URL path, this registry setting will be prepended. This configuration is also used to determine authentication details, so even if the request URL references a completely different host, {\ttfamily opts.\+registry} will be used to find the auth details for that request.

See also \href{\#opts-scope}{\texttt{ {\ttfamily opts.\+scope}}}, \href{\#opts-spec}{\texttt{ {\ttfamily opts.\+spec}}}, and \href{\#opts-scope-registry}{\texttt{ {\ttfamily opts.$<$scope$>$\+:registry}}} which can all affect the actual registry URL used by the outgoing request.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18720}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/retry\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+retry$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18720}

\begin{DoxyItemize}
\item Type\+: Object
\item Default\+: null
\end{DoxyItemize}

Single-\/object configuration for request retry settings. If passed in, will override individually-\/passed {\ttfamily fetch-\/retry-\/$\ast$} settings.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18721}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/scope\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+scope$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18721}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

Associate an operation with a scope for a scoped registry. This option can force lookup of scope-\/specific registries and authentication.

See also \href{\#opts-scope-registry}{\texttt{ {\ttfamily opts.$<$scope$>$\+:registry}}} and \href{\#opts-spec}{\texttt{ {\ttfamily opts.\+spec}}} for interactions with this option.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18722}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/scope-\/registry\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.$<$scope$>$\+:registry$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18722}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

This option type can be used to configure the registry used for requests involving a particular scope. For example, `opts\mbox{[}'@myscope\+:registry\textquotesingle{}\mbox{]} = \textquotesingle{}\href{https://scope-specific.registry/'}{\texttt{ https\+://scope-\/specific.\+registry/\textquotesingle{}}}{\ttfamily will make it so requests go out to this registry instead of \mbox{[}}opts.\+registry$<$tt$>$\mbox{]}(\#opts-\/registry) when \mbox{[}opts.\+scope$<$tt$>$\mbox{]}(\#opts-\/scope) is used, or when \mbox{[}opts.\+spec\`{}\mbox{]}(\#opts-\/spec) is a scoped package spec.

The {\ttfamily @} before the scope name is optional, but recommended.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18723}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/spec\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+spec$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18723}

\begin{DoxyItemize}
\item Type\+: String $\vert$ \href{https://npm.im/npm-registry-arg}{\texttt{ {\ttfamily npm-\/registry-\/arg}}} object.
\item Default\+: null
\end{DoxyItemize}

If provided, can be used to automatically configure \href{\#opts-scope}{\texttt{ {\ttfamily opts.\+scope}}} based on a specific package name. Non-\/registry package specs will throw an error.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18724}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/strict-\/ssl\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+strict-\/ssl$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18724}

\begin{DoxyItemize}
\item Type\+: Boolean
\item Default\+: true
\end{DoxyItemize}

Whether or not to do SSL key validation when making requests to the registry via https.

See also \href{\#opts-ca}{\texttt{ {\ttfamily opts.\+ca}}}.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18725}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/timeout\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+timeout$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18725}

\begin{DoxyItemize}
\item Type\+: Milliseconds
\item Default\+: 0 (no timeout)
\end{DoxyItemize}

Time before a hanging request times out.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18726}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/token\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+token$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18726}

\begin{DoxyItemize}
\item Alias\+: {\ttfamily opts.\+\_\+auth\+Token}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

Authentication token string.

Can be scoped to a registry by using a \char`\"{}nerf dart\char`\"{} for that registry. That is\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  '//registry.npmjs.org/:token': 't0k3nH34r'}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18727}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/user-\/agent\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+user-\/agent$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18727}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: `\textquotesingle{}npm-\/registry-\/fetch$<$version$>$/node$<$node-\/version$>$+$<$arch$>$ ($<$platform$>$)'\`{}
\end{DoxyItemize}

User agent string to send in the {\ttfamily User-\/\+Agent} header.\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18728}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/username\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+username$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18728}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

Username used for basic authentication. For the more modern authentication method, please use the (more secure) \href{\#opts-token}{\texttt{ {\ttfamily opts.\+token}}}

Can optionally be scoped to a registry by using a \char`\"{}nerf dart\char`\"{} for that registry. That is\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  '//registry.npmjs.org/:username': 't0k3nH34r'}
\DoxyCodeLine{\} }

\end{DoxyCode}


See also \href{\#opts-password}{\texttt{ {\ttfamily opts.\+password}}}\hypertarget{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18729}{}\doxyparagraph{$<$a name=\char`\"{}opts-\/auth\char`\"{}$>$$<$/a$>$ $<$tt$>$opts.\+\_\+auth$<$/tt$>$}\label{md_sfcode_node_modules_npm_registry_fetch_README_autotoc_md18729}

\begin{DoxyItemize}
\item Type\+: String
\item Default\+: null
\end{DoxyItemize}

$\ast$$\ast$ DEPRECATED $\ast$$\ast$ This is a legacy authentication token supported only for compatibility. Please use \href{\#opts-token}{\texttt{ {\ttfamily opts.\+token}}} instead. 