# socks-proxy-agent

> A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS

Latest version **10.1.0** (published 2026-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install socks-proxy-agent
pnpm add socks-proxy-agent
yarn add socks-proxy-agent
bun add socks-proxy-agent
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 10.1.0 |
| Published | 2026-06-08 |
| First published | 2013-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >= 20 |
| Dependencies | 3 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1163 |
| Author | Nathan Rajlich |
| Maintainers | tootallnate, kikobeats |
| Keywords | agent, http, https, proxy, socks, socks4, socks4a, socks5, socks5h |

## Links

- npm: https://www.npmjs.com/package/socks-proxy-agent
- Repository: https://github.com/TooTallNate/proxy-agents
- Homepage: https://github.com/TooTallNate/proxy-agents#readme
- Issues: https://github.com/TooTallNate/proxy-agents/issues
- npm.io page: https://npm.io/package/socks-proxy-agent

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [socks](https://npm.io/package/socks.md) ^2.8.3
- [agent-base](https://npm.io/package/agent-base.md) 9.0.0

## Recent versions

- 10.1.0 (latest) — 2026-06-08
- 6.2.0-beta.1 (beta) — 2022-02-15
- 10.0.0 — 2026-04-01
- 9.0.0 — 2026-03-11
- 8.0.5 — 2024-12-07
- 8.0.4 — 2024-06-28
- 8.0.3 — 2024-03-30
- 8.0.2 — 2023-09-04
- 8.0.1 — 2023-05-05
- 8.0.0 — 2023-05-04
- 7.0.0 — 2022-05-31
- 6.2.1 — 2022-05-31
- 6.2.0 — 2022-04-17
- 6.2.0-beta.0 — 2022-02-12
- 6.1.1 — 2021-11-22
- … 20 more at https://npm.io/package/socks-proxy-agent/versions

## README

socks-proxy-agent
================
### A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS

This module provides an `http.Agent` implementation that connects to a
specified SOCKS proxy server, and can be used with the built-in `http`
and `https` modules.

It can also be used in conjunction with the `ws` module to establish a WebSocket
connection over a SOCKS proxy. See the "Examples" section below.

Examples
--------

```ts
import https from 'https';
import { SocksProxyAgent } from 'socks-proxy-agent';

const agent = new SocksProxyAgent(
	'socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com'
);

https.get('https://ipinfo.io', { agent }, (res) => {
	console.log(res.headers);
	res.pipe(process.stdout);
});
```

#### `ws` WebSocket connection example

```ts
import WebSocket from 'ws';
import { SocksProxyAgent } from 'socks-proxy-agent';

const agent = new SocksProxyAgent(
	'socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com'
);

var socket = new WebSocket('ws://echo.websocket.events', { agent });

socket.on('open', function () {
	console.log('"open" event!');
	socket.send('hello world');
});

socket.on('message', function (data, flags) {
	console.log('"message" event! %j %j', data, flags);
	socket.close();
});
```

---
_Source: https://npm.io/package/socks-proxy-agent · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
