0.1.6 • Published 4 years ago

node-fetch-with-proxy v0.1.6

Weekly downloads
297
License
MIT
Repository
github
Last release
4 years ago

node-fetch-with-proxy

Thin wrapper of node-fetch that can be used behind the proxy.

Install

npm install node-fetch-with-proxy

Usage

API is the same as node-fetch.

const fetch = require('node-fetch-with-proxy');

fetch('http://httpbin.org/get')
  .then(res => res.json())
  .then(json => console.log(json));

Unlike node-fetch, proxy can be set by environment variable.

export HTTP_PROXY=http://your.proxy:8888

Environment variables are only valid for Node.js. Note that the browser uses its own proxy settings instead.