Skip to content
Creating a proxy string from objects.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.eslintrc
.gitignore
.npmrc
.prettierrc
.travis.yml
LICENSE
README.md
jest.config.js
package.json
tsconfig.json

README.md

Proxy to String

Build Status npm

Creating a proxy string from objects.

npm i proxy-to-string

Examples:

const proxyToString = require('proxy-to-string');
proxyToString({
  protocol: 'https',
  ipAddress: '123.123.2.42',
  port: '8080',
  login: 'superLogin',
  password: 'superPassword'
});

// return this:
// 'https://123.123.2.42:8080@superLogin:superPassword'

If you want the login and password to go at the beginning, just put loginPassFirst: true

const proxyToString = require('proxy-to-string');
proxyToString({
  protocol: 'https',
  ipAddress: '123.123.2.42',
  port: '8080',
  login: 'superLogin',
  password: 'superPassword',
  loginPassFirst: true
});

// return this:
// 'https://superLogin:superPassword@123.123.2.42:8080'

If your login and password looks like this: superLogin:superPassword or/and your ip address: 123.123.2.42: 8080 then use loginPassword and/or ipAddressPort. These options are always in priority.

const proxyToString = require('proxy-to-string');
proxyToString({
  protocol: 'https',
  loginPassword: 'superLogin:superPassword',
  ipAddressPort: '123.123.2.42:8080'
});

// return this:
// 'https://123.123.2.42:8080@superLogin:superPassword'

You can ignore any options, and, say, leave only ipAddress and port

const proxyToString = require('proxy-to-string');
proxyToString({
  ipAddress: '123.123.2.42',
  port: '8080'
});

// return this:
// '123.123.2.42:8080'
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.