{\bfseries{This module will be deprecated once npm v7 is released. Please do not rely on it more than absolutely necessary.}}

The fetch implementation used by npm v7 is \href{http://npm.im/minipass-fetch}{\texttt{ minipass-\/fetch}}. You may also be interested in \href{http://npm.im/make-fetch-happen}{\texttt{ make-\/fetch-\/happen}} (which adds caching) and \href{http://npm.im/npm-registry-fetch}{\texttt{ npm-\/registry-\/fetch}} (which contains business logic for interacting with the npm registry specifically).

\DoxyHorRuler{0}
\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18102}{}\doxysection{node-\/fetch-\/npm}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18102}
\href{https://www.npmjs.com/package/node-fetch-npm}{\texttt{ }} \href{https://travis-ci.org/npm/node-fetch-npm}{\texttt{ }} \href{https://codecov.io/gh/npm/node-fetch-npm}{\texttt{ }}

A light-\/weight module that brings {\ttfamily window.\+fetch} to Node.\+js

{\ttfamily node-\/fetch-\/npm} is a fork of \href{https://npm.im/node-fetch}{\texttt{ {\ttfamily node-\/fetch}}} used in npm itself, through \href{https://npm.im/make-fetch-happen}{\texttt{ {\ttfamily make-\/fetch-\/happen}}}. It has more regular releases and accepts some patches that would not fit with {\ttfamily node-\/fetch}\textquotesingle{}s own design goals (such as picking a specific cookie library, removing {\ttfamily babel} dependency altogether, etc).

This library is {\itshape not a replacement} for {\ttfamily node-\/fetch}, nor does it intend to supplant it. It\textquotesingle{}s purely a fork maintained for the sake of easier patching of specific needs that it wouldn\textquotesingle{}t be fair to shove down the main project\textquotesingle{}s throat. This project will still send patches for shared bugs over and hopefully help improve its \char`\"{}parent\char`\"{}.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18103}{}\doxysubsection{Motivation}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18103}
Instead of implementing {\ttfamily XMLHttp\+Request} in Node.\+js to run browser-\/specific \href{https://github.com/github/fetch}{\texttt{ Fetch polyfill}}, why not go from native {\ttfamily http} to {\ttfamily fetch} API directly? Hence {\ttfamily node-\/fetch}, minimal code for a {\ttfamily window.\+fetch} compatible API on Node.\+js runtime.

See Matt Andrews\textquotesingle{} \href{https://github.com/matthew-andrews/isomorphic-fetch}{\texttt{ isomorphic-\/fetch}} for isomorphic usage (exports {\ttfamily node-\/fetch} for server-\/side, {\ttfamily whatwg-\/fetch} for client-\/side).\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18104}{}\doxysubsection{Features}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18104}

\begin{DoxyItemize}
\item Stay consistent with {\ttfamily window.\+fetch} API.
\item Make conscious trade-\/off when following \href{https://fetch.spec.whatwg.org/}{\texttt{ whatwg fetch spec}} and \href{https://streams.spec.whatwg.org/}{\texttt{ stream spec}} implementation details, document known difference.
\item Use native promise, but allow substituting it with \mbox{[}insert your favorite promise library\mbox{]}.
\item Use native stream for body, on both request and response.
\item Decode content encoding (gzip/deflate) properly, and convert string output (such as {\ttfamily res.\+text()} and {\ttfamily res.\+json()}) to UTF-\/8 automatically.
\item Useful extensions such as timeout, redirect limit, response size limit, \mbox{[}explicit errors\mbox{]}\mbox{[}\mbox{]} for troubleshooting.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18105}{}\doxysubsection{Difference from client-\/side fetch}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18105}

\begin{DoxyItemize}
\item See \href{https://github.com/npm/node-fetch-npm/blob/master/LIMITS.md}{\texttt{ Known Differences}} for details.
\item If you happen to use a missing feature that {\ttfamily window.\+fetch} offers, feel free to open an issue.
\item Pull requests are welcomed too!
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18106}{}\doxysubsection{Install}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18106}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install node-\/fetch-\/npm -\/-\/save }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18107}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18107}

\begin{DoxyCode}{0}
\DoxyCodeLine{import fetch from 'node-\/fetch';}
\DoxyCodeLine{// or}
\DoxyCodeLine{// const fetch = require('node-\/fetch');}
\DoxyCodeLine{}
\DoxyCodeLine{// if you are using your own Promise library, set it through fetch.Promise. Eg.}
\DoxyCodeLine{}
\DoxyCodeLine{// import Bluebird from 'bluebird';}
\DoxyCodeLine{// fetch.Promise = Bluebird;}
\DoxyCodeLine{}
\DoxyCodeLine{// plain text or html}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('https://github.com/')}
\DoxyCodeLine{    .then(res => res.text())}
\DoxyCodeLine{    .then(body => console.log(body));}
\DoxyCodeLine{}
\DoxyCodeLine{// json}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('https://api.github.com/users/github')}
\DoxyCodeLine{    .then(res => res.json())}
\DoxyCodeLine{    .then(json => console.log(json));}
\DoxyCodeLine{}
\DoxyCodeLine{// catching network error}
\DoxyCodeLine{// 3xx-\/5xx responses are NOT network errors, and should be handled in then()}
\DoxyCodeLine{// you only need one catch() at the end of your promise chain}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('http://domain.invalid/')}
\DoxyCodeLine{    .catch(err => console.error(err));}
\DoxyCodeLine{}
\DoxyCodeLine{// stream}
\DoxyCodeLine{// the node.js way is to use stream when possible}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('https://assets-\/cdn.github.com/images/modules/logos\_page/Octocat.png')}
\DoxyCodeLine{    .then(res => \{}
\DoxyCodeLine{        const dest = fs.createWriteStream('./octocat.png');}
\DoxyCodeLine{        res.body.pipe(dest);}
\DoxyCodeLine{    \});}
\DoxyCodeLine{}
\DoxyCodeLine{// buffer}
\DoxyCodeLine{// if you prefer to cache binary data in full, use buffer()}
\DoxyCodeLine{// note that buffer() is a node-\/fetch only API}
\DoxyCodeLine{}
\DoxyCodeLine{import fileType from 'file-\/type';}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('https://assets-\/cdn.github.com/images/modules/logos\_page/Octocat.png')}
\DoxyCodeLine{    .then(res => res.buffer())}
\DoxyCodeLine{    .then(buffer => fileType(buffer))}
\DoxyCodeLine{    .then(type => \{ /* ... */ \});}
\DoxyCodeLine{}
\DoxyCodeLine{// meta}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('https://github.com/')}
\DoxyCodeLine{    .then(res => \{}
\DoxyCodeLine{        console.log(res.ok);}
\DoxyCodeLine{        console.log(res.status);}
\DoxyCodeLine{        console.log(res.statusText);}
\DoxyCodeLine{        console.log(res.headers.raw());}
\DoxyCodeLine{        console.log(res.headers.get('content-\/type'));}
\DoxyCodeLine{    \});}
\DoxyCodeLine{}
\DoxyCodeLine{// post}
\DoxyCodeLine{}
\DoxyCodeLine{fetch('http://httpbin.org/post', \{ method: 'POST', body: 'a=1' \})}
\DoxyCodeLine{    .then(res => res.json())}
\DoxyCodeLine{    .then(json => console.log(json));}
\DoxyCodeLine{}
\DoxyCodeLine{// post with stream from file}
\DoxyCodeLine{}
\DoxyCodeLine{import \{ createReadStream \} from 'fs';}
\DoxyCodeLine{}
\DoxyCodeLine{const stream = createReadStream('input.txt');}
\DoxyCodeLine{fetch('http://httpbin.org/post', \{ method: 'POST', body: stream \})}
\DoxyCodeLine{    .then(res => res.json())}
\DoxyCodeLine{    .then(json => console.log(json));}
\DoxyCodeLine{}
\DoxyCodeLine{// post with JSON}
\DoxyCodeLine{}
\DoxyCodeLine{var body = \{ a: 1 \};}
\DoxyCodeLine{fetch('http://httpbin.org/post', \{}
\DoxyCodeLine{    method: 'POST',}
\DoxyCodeLine{    body:    JSON.stringify(body),}
\DoxyCodeLine{    headers: \{ 'Content-\/Type': 'application/json' \},}
\DoxyCodeLine{\})}
\DoxyCodeLine{    .then(res => res.json())}
\DoxyCodeLine{    .then(json => console.log(json));}
\DoxyCodeLine{}
\DoxyCodeLine{// post with form-\/data (detect multipart)}
\DoxyCodeLine{}
\DoxyCodeLine{import FormData from 'form-\/data';}
\DoxyCodeLine{}
\DoxyCodeLine{const form = new FormData();}
\DoxyCodeLine{form.append('a', 1);}
\DoxyCodeLine{fetch('http://httpbin.org/post', \{ method: 'POST', body: form \})}
\DoxyCodeLine{    .then(res => res.json())}
\DoxyCodeLine{    .then(json => console.log(json));}
\DoxyCodeLine{}
\DoxyCodeLine{// post with form-\/data (custom headers)}
\DoxyCodeLine{// note that getHeaders() is non-\/standard API}
\DoxyCodeLine{}
\DoxyCodeLine{import FormData from 'form-\/data';}
\DoxyCodeLine{}
\DoxyCodeLine{const form = new FormData();}
\DoxyCodeLine{form.append('a', 1);}
\DoxyCodeLine{fetch('http://httpbin.org/post', \{ method: 'POST', body: form, headers: form.getHeaders() \})}
\DoxyCodeLine{    .then(res => res.json())}
\DoxyCodeLine{    .then(json => console.log(json));}
\DoxyCodeLine{}
\DoxyCodeLine{// node 7+ with async function}
\DoxyCodeLine{}
\DoxyCodeLine{(async function () \{}
\DoxyCodeLine{    const res = await fetch('https://api.github.com/users/github');}
\DoxyCodeLine{    const json = await res.json();}
\DoxyCodeLine{    console.log(json);}
\DoxyCodeLine{\})(); }

\end{DoxyCode}


See \href{https://github.com/npm/node-fetch-npm/blob/master/test/test.js}{\texttt{ test cases}} for more examples.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18108}{}\doxysubsection{API}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18108}
\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18109}{}\doxysubsubsection{fetch(url\mbox{[}, options\mbox{]})}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18109}

\begin{DoxyItemize}
\item {\ttfamily url} A string representing the URL for fetching
\item {\ttfamily options} \href{\#fetch-options}{\texttt{ Options}} for the HTTP(\+S) request
\item Returns\+: {\ttfamily Promise$<$\href{\#class-response}{\texttt{ Response}}$>$}
\end{DoxyItemize}

Perform an HTTP(\+S) fetch.

{\ttfamily url} should be an absolute url, such as {\ttfamily \href{http://example.com/}{\texttt{ http\+://example.\+com/}}}. A path-\/relative URL ({\ttfamily /file/under/root}) or protocol-\/relative URL ({\ttfamily //can-\/be-\/http-\/or-\/https.com/}) will result in a rejected promise.

\label{_fetch-options}%
 \hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18110}{}\doxyparagraph{Options}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18110}
The default values are shown after each option key.


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{    // These properties are part of the Fetch Standard}
\DoxyCodeLine{    method: 'GET',}
\DoxyCodeLine{    headers: \{\},        // request headers. format is the identical to that accepted by the Headers constructor (see below)}
\DoxyCodeLine{    body: null,         // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream}
\DoxyCodeLine{    redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect}
\DoxyCodeLine{}
\DoxyCodeLine{    // The following properties are node-\/fetch-\/npm extensions}
\DoxyCodeLine{    follow: 20,         // maximum redirect count. 0 to not follow redirect}
\DoxyCodeLine{    timeout: 0,         // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)}
\DoxyCodeLine{    compress: true,     // support gzip/deflate content encoding. false to disable}
\DoxyCodeLine{    size: 0,            // maximum response body size in bytes. 0 to disable}
\DoxyCodeLine{    agent: null         // http(s).Agent instance, allows custom proxy, certificate etc.}
\DoxyCodeLine{\} }

\end{DoxyCode}


\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18111}%
\Hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18111}%
\doxysubparagraph*{Default Headers}

If no values are set, the following request headers will be sent automatically\+:

\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Header   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Value    }\\\cline{1-2}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Header   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Value    }\\\cline{1-2}
\endhead
{\ttfamily Accept-\/\+Encoding}   &{\ttfamily gzip,deflate} \+\_\+(when {\ttfamily options.\+compress === true})\+\_\+    \\\cline{1-2}
{\ttfamily Accept}   &{\ttfamily $\ast$/$\ast$}    \\\cline{1-2}
{\ttfamily Connection}   &{\ttfamily close} \+\_\+(when no {\ttfamily options.\+agent} is present)\+\_\+    \\\cline{1-2}
{\ttfamily Content-\/\+Length}   &\+\_\+(automatically calculated, if possible)\+\_\+    \\\cline{1-2}
{\ttfamily User-\/\+Agent}   &{\ttfamily node-\/fetch-\/npm/1.\+0 (+\href{https://github.com/npm/node-fetch-npm}{\texttt{ https\+://github.\+com/npm/node-\/fetch-\/npm}})}   \\\cline{1-2}
\end{longtabu}


\label{_class-request}%
 \hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18112}{}\doxysubsubsection{Class\+: Request}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18112}
An HTTP(\+S) request containing information about URL, method, headers, and the body. This class implements the \href{\#iface-body}{\texttt{ Body}} interface.

Due to the nature of Node.\+js, the following properties are not implemented at this moment\+:


\begin{DoxyItemize}
\item {\ttfamily type}
\item {\ttfamily destination}
\item {\ttfamily referrer}
\item {\ttfamily referrer\+Policy}
\item {\ttfamily mode}
\item {\ttfamily credentials}
\item {\ttfamily cache}
\item {\ttfamily integrity}
\item {\ttfamily keepalive}
\end{DoxyItemize}

The following node-\/fetch-\/npm extension properties are provided\+:


\begin{DoxyItemize}
\item {\ttfamily follow}
\item {\ttfamily compress}
\item {\ttfamily counter}
\item {\ttfamily agent}
\end{DoxyItemize}

See \href{\#fetch-options}{\texttt{ options}} for exact meaning of these extensions.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18113}{}\doxyparagraph{new Request(input\mbox{[}, options\mbox{]})}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18113}

\footnotesize $\ast$(spec-\/compliant)$\ast$
\normalsize 


\begin{DoxyItemize}
\item {\ttfamily input} A string representing a URL, or another {\ttfamily Request} (which will be cloned)
\item {\ttfamily options} \mbox{[}Options\mbox{]}\mbox{[}\#fetch-\/options\mbox{]} for the HTTP(\+S) request
\end{DoxyItemize}

Constructs a new {\ttfamily Request} object. The constructor is identical to that in the \href{https://developer.mozilla.org/en-US/docs/Web/API/Request/Request}{\texttt{ browser}}.

In most cases, directly {\ttfamily fetch(url, options)} is simpler than creating a {\ttfamily Request} object.

\label{_class-response}%
 \hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18114}{}\doxysubsubsection{Class\+: Response}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18114}
An HTTP(\+S) response. This class implements the \href{\#iface-body}{\texttt{ Body}} interface.

The following properties are not implemented in node-\/fetch-\/npm at this moment\+:


\begin{DoxyItemize}
\item {\ttfamily Response.\+error()}
\item {\ttfamily Response.\+redirect()}
\item {\ttfamily type}
\item {\ttfamily redirected}
\item {\ttfamily trailer}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18115}{}\doxyparagraph{new Response(\mbox{[}body\mbox{[}, options\mbox{]}\mbox{]})}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18115}

\footnotesize $\ast$(spec-\/compliant)$\ast$
\normalsize 


\begin{DoxyItemize}
\item {\ttfamily body} A string or \href{https://nodejs.org/api/stream.html\#stream_readable_streams}{\texttt{ Readable stream}}
\item {\ttfamily options} A \href{https://fetch.spec.whatwg.org/\#responseinit}{\texttt{ {\ttfamily Response\+Init}}} options dictionary
\end{DoxyItemize}

Constructs a new {\ttfamily Response} object. The constructor is identical to that in the \href{https://developer.mozilla.org/en-US/docs/Web/API/Response/Response}{\texttt{ browser}}.

Because Node.\+js does not implement service workers (for which this class was designed), one rarely has to construct a {\ttfamily Response} directly.

\label{_class-headers}%
 \hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18116}{}\doxysubsubsection{Class\+: Headers}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18116}
This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the \href{https://fetch.spec.whatwg.org/}{\texttt{ Fetch Standard}} are implemented.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18117}{}\doxyparagraph{new Headers(\mbox{[}init\mbox{]})}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18117}

\footnotesize $\ast$(spec-\/compliant)$\ast$
\normalsize 


\begin{DoxyItemize}
\item {\ttfamily init} Optional argument to pre-\/fill the {\ttfamily Headers} object
\end{DoxyItemize}

Construct a new {\ttfamily Headers} object. {\ttfamily init} can be either {\ttfamily null}, a {\ttfamily Headers} object, an key-\/value map object, or any iterable object.


\begin{DoxyCode}{0}
\DoxyCodeLine{// Example adapted from https://fetch.spec.whatwg.org/\#example-\/headers-\/class}
\DoxyCodeLine{}
\DoxyCodeLine{const meta = \{}
\DoxyCodeLine{  'Content-\/Type': 'text/xml',}
\DoxyCodeLine{  'Breaking-\/Bad': '<3'}
\DoxyCodeLine{\};}
\DoxyCodeLine{const headers = new Headers(meta);}
\DoxyCodeLine{}
\DoxyCodeLine{// The above is equivalent to}
\DoxyCodeLine{const meta = [}
\DoxyCodeLine{  [ 'Content-\/Type', 'text/xml' ],}
\DoxyCodeLine{  [ 'Breaking-\/Bad', '<3' ]}
\DoxyCodeLine{];}
\DoxyCodeLine{const headers = new Headers(meta);}
\DoxyCodeLine{}
\DoxyCodeLine{// You can in fact use any iterable objects, like a Map or even another Headers}
\DoxyCodeLine{const meta = new Map();}
\DoxyCodeLine{meta.set('Content-\/Type', 'text/xml');}
\DoxyCodeLine{meta.set('Breaking-\/Bad', '<3');}
\DoxyCodeLine{const headers = new Headers(meta);}
\DoxyCodeLine{const copyOfHeaders = new Headers(headers); }

\end{DoxyCode}


\label{_iface-body}%
 \hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18118}{}\doxysubsubsection{Interface\+: Body}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18118}
{\ttfamily Body} is an abstract interface with methods that are applicable to both {\ttfamily Request} and {\ttfamily Response} classes.

The following methods are not yet implemented in node-\/fetch-\/npm at this moment\+:


\begin{DoxyItemize}
\item {\ttfamily form\+Data()}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18119}{}\doxyparagraph{body.\+body}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18119}

\footnotesize $\ast$(deviation from spec)$\ast$
\normalsize 


\begin{DoxyItemize}
\item Node.\+js \href{https://nodejs.org/api/stream.html\#stream_readable_streams}{\texttt{ {\ttfamily Readable} stream}}
\end{DoxyItemize}

The data encapsulated in the {\ttfamily Body} object. Note that while the \href{https://fetch.spec.whatwg.org/}{\texttt{ Fetch Standard}} requires the property to always be a WHATWG {\ttfamily Readable\+Stream}, in node-\/fetch-\/npm it is a Node.\+js \href{https://nodejs.org/api/stream.html\#stream_readable_streams}{\texttt{ {\ttfamily Readable} stream}}.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18120}{}\doxyparagraph{body.\+body\+Used}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18120}

\footnotesize $\ast$(spec-\/compliant)$\ast$
\normalsize 


\begin{DoxyItemize}
\item {\ttfamily Boolean}
\end{DoxyItemize}

A boolean property for if this body has been consumed. Per spec, a consumed body cannot be used again.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18121}{}\doxyparagraph{body.\+array\+Buffer()}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18121}
\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18122}{}\doxyparagraph{body.\+blob()}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18122}
\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18123}{}\doxyparagraph{body.\+json()}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18123}
\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18124}{}\doxyparagraph{body.\+text()}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18124}

\footnotesize $\ast$(spec-\/compliant)$\ast$
\normalsize 


\begin{DoxyItemize}
\item Returns\+: {\ttfamily Promise}
\end{DoxyItemize}

Consume the body and return a promise that will resolve to one of these formats.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18125}{}\doxyparagraph{body.\+buffer()}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18125}

\footnotesize $\ast$(node-\/fetch-\/npm extension)$\ast$
\normalsize 


\begin{DoxyItemize}
\item Returns\+: {\ttfamily Promise$<$Buffer$>$}
\end{DoxyItemize}

Consume the body and return a promise that will resolve to a Buffer.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18126}{}\doxyparagraph{body.\+text\+Converted()}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18126}

\footnotesize $\ast$(node-\/fetch-\/npm extension)$\ast$
\normalsize 


\begin{DoxyItemize}
\item Returns\+: {\ttfamily Promise$<$String$>$}
\end{DoxyItemize}

Identical to {\ttfamily body.\+text()}, except instead of always converting to UTF-\/8, encoding sniffing will be performed and text converted to UTF-\/8, if possible.

\label{_class-fetcherror}%
 \hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18127}{}\doxysubsubsection{Class\+: Fetch\+Error}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18127}

\footnotesize $\ast$(node-\/fetch-\/npm extension)$\ast$
\normalsize 

An operational error in the fetching process. See \href{https://github.com/npm/node-fetch-npm/blob/master/ERROR-HANDLING.md}{\texttt{ ERROR-\/\+HANDLING.\+md}} for more info.\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18128}{}\doxysubsection{License}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18128}
MIT\hypertarget{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18129}{}\doxysubsection{Acknowledgement}\label{md_sfcode_node_modules_node_fetch_npm_README_autotoc_md18129}
Thanks to \href{https://github.com/github/fetch}{\texttt{ github/fetch}} for providing a solid implementation reference. 