

The following node-fetch extension properties are provided: This class implements the Body interface.ĭue to the nature of Node.js, the following properties are not implemented at this moment: Import fetch from 'node-fetch' class HTTPResponseError extends Error Īn HTTP(S) request containing information about URL, method, headers, and the body.
Node fetch download file free#
Node fetch download file code#
Instead of implementing XMLHttpRequest in Node.js to run browser-specific Fetch polyfill, why not go from native http to fetch API directly? Hence, node-fetch, minimal code for a window.fetch compatible API on Node.js runtime. All methods specified in the Fetch Standard are implemented.A light-weight module that brings Fetch API to Node.js.Ĭonsider supporting us on our Open Collective: This class allows manipulating and iterating over a set of HTTP headers. node-fetch only supports 'default' and 'error' and does not make use of filtered responses. response.typeĬonvenience property representing the response's type. Will evaluate to true if the internal redirect counter is greater than 0. response.redirectedĬonvenience property representing if the request has been redirected at least once. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. response.okĬonvenience property representing if the request ended normally. The constructor is identical to that in the browser.īecause Node.js does not implement service workers (for which this class was designed), one rarely has to construct a Response directly. options A ResponseInit options dictionaryĬonstructs a new Response object.The following properties are not implemented in node-fetch at this moment: This class implements the Body interface. In most cases, directly fetch(url, options) is simpler than creating a Request object.Īn HTTP(S) response. The constructor is identical to that in the browser. options Options for the HTTP(S) requestĬonstructs a new Request object.



A light-weight module that brings Fetch API to Node.js.Ĭonsider supporting us on our Open Collective:
