cross-os-proxy
configure system proxy settings
support platforms:
- windows
- macOS
Install
$ npm i --save cross-os-proxy
Usage
const osProxy = require('cross-os-proxy');
(async () => {
await osProxy.setProxy('127.0.0.1', 9999); // set http and https proxy
console.log('done');
})();
(async () => {
await osProxy.closeProxy(); // close http and https proxy
console.log('done');
})();
or you want to set authenticated proxy, just pass username and password as the third and fourth parameter
(async () => {
await osProxy.setProxy('127.0.0.1', 9999, 'username', 'password');
console.log('done');
})();
Using on the command line
$ npm i cross-os-proxy -g
Usage: osProxy on <host> <port> [<username>] [<password>]
Usage: osProxy off
example
osProxy on 127.0.0.1 1234 name password
osProxy off