https://github.com/vladpuz/proxy-string-parser
Parsing proxy string
https://github.com/vladpuz/proxy-string-parser
parser proxy string
Last synced: about 1 year ago
JSON representation
Parsing proxy string
- Host: GitHub
- URL: https://github.com/vladpuz/proxy-string-parser
- Owner: vladpuz
- Created: 2022-11-11T21:25:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-01T17:09:32.000Z (over 2 years ago)
- Last Synced: 2025-02-19T05:42:25.346Z (over 1 year ago)
- Topics: parser, proxy, string
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/proxy-string-parser
- Size: 1.01 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# proxy-string-parser
## Deprecated
Use native URL objects instead: https://developer.mozilla.org/en-US/docs/Web/API/URL.
Example:
```typescript
const url1 = new URL('https://username:password@localhost:3000')
const url2 = new URL('https://localhost:3000')
console.log(url1.protocol, url1.username, url1.password, url1.hostname, url1.port)
console.log(url2.protocol, url2.hostname, url2.port)
```
## Introduction
Parsing strings of the following formats:
```text
protocol://username:password@host:port
protocol://host:port
username:password@host:port
host:port
```
To the Proxy object:
```typescript
interface Proxy {
host: string
port: number
auth?: {
username: string
password: string
}
protocol?: string
}
```
TypeDoc documentation is available on [wiki](https://github.com/vladislav-puzyrev/proxy-string-parser/wiki).
## Install
```bash
npm install proxy-string-parser
```
## Usage
```javascript
import proxyStringParser from 'proxy-string-parser'
const proxy = proxyStringParser('protocol://username:password@host:80')
console.log(proxy)
```