Socket
Socket
Sign inDemoInstall

node-fetch-with-proxy

Package Overview
Dependencies
64
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "node-fetch-with-proxy",
"version": "0.1.1",
"version": "0.1.2",
"description": "node-fetch with proxy-agent",

@@ -5,0 +5,0 @@ "main": "lib/fetch-with-proxy.js",

@@ -5,8 +5,6 @@ # node-fetch-with-proxy

The proxy specified by the environment variable (HTTP_PROXY, https_proxy, etc.) is used in Node.js environment.
## Install
```sh
$ npm install node-fetch-with-proxy
npm install node-fetch-with-proxy
```

@@ -16,15 +14,19 @@

See [node-fetch](https://www.npmjs.com/package/node-fetch)
API is the same as `node-fetch`.
## Advanced Usage
```javascript
const fetch = require('node-fetch-with-proxy');
You can explicitly specify proxy options with the 3rd argument of `fetch` API.
fetch('http://httpbin.org/get')
.then(res => res.json())
.then(json => console.log(json));
```
```javascript
const proxyUrl = 'http://your.proxy:port';
Unlike node-fetch, proxy can be set by environment variable.
fetch('https://httpbin.org/post', {
method: 'POST',
body: 'foo=bar'
}, proxyUrl);
```sh
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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc