An simple agent for HTTP and HTTPS through HTTP and SOCKS proxies
npm install simple-proxy-agent
const fetch = require('node-fetch');
const ProxyAgent = require('simple-proxy-agent');
fetch('https://example.com', {
agent: new ProxyAgent('http://0.0.0.0:8080', {
// Options, with all defaults
tunnel: true, // If true, will tunnel all HTTPS using CONNECT method
timeout: 5000, // Time in milli-seconds, to maximum wait for proxy connection to establish
})
})
.then(res => res.text())
.then(body => console.log(body))
.catch(err => console.error(err))
const fetch = require('node-fetch');
const ProxyAgent = require('simple-proxy-agent');
fetch('https://example.com', {
agent: new ProxyAgent('http://user:password@0.0.0.0:8080')
})
.then(res => res.text())
.then(body => console.log(body))
.catch(err => console.error(err))
MIT