https://github.com/ganevdev/proxy-to-string
Creating a proxy string from objects.
https://github.com/ganevdev/proxy-to-string
Last synced: 10 months ago
JSON representation
Creating a proxy string from objects.
- Host: GitHub
- URL: https://github.com/ganevdev/proxy-to-string
- Owner: ganevdev
- License: mit
- Created: 2019-02-12T14:09:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T07:37:25.000Z (almost 7 years ago)
- Last Synced: 2025-03-13T14:39:01.291Z (11 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/proxy-to-string
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Proxy to String
[](https://travis-ci.com/Ganevru/proxy-to-string)
[](http://npm.im/proxy-to-string)
Creating a proxy string from objects.
```bash
npm i proxy-to-string
```
Examples:
```js
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`
```js
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.
```js
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`
```js
const proxyToString = require('proxy-to-string');
proxyToString({
ipAddress: '123.123.2.42',
port: '8080'
});
// return this:
// '123.123.2.42:8080'
```