Registry / http-networking / socks5-http-client

socks5-http-client

JSON →
library1.0.4jsnpmunverified

This package provides a SOCKS v5 HTTP client implementation specifically for Node.js environments. It enables making HTTP requests through a SOCKS5 proxy, commonly used for anonymizing traffic via services like Tor. The current stable version is 1.0.4, last published over eight years ago (July 2018). The library focuses solely on HTTP, explicitly directing users to a separate `socks5-https-client` package for HTTPS. Its primary differentiators were its straightforward integration with the deprecated `request` library and its direct support for SOCKS5 proxying, including authentication. Due to its age and lack of updates, it is largely incompatible with modern Node.js versions and lacks contemporary features like Promise-based APIs.

npm install socks5-http-client
INSTALL
IMPORT
SIG · SOCKS5-HTTP-CLIENT
S
socks5-http-client
http-networkingjavascriptv1.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

shttp
const shttp = require('socks5-http-client');
import shttp from 'socks5-http-client';
This package is CommonJS only. Attempting to use ES module import syntax will result in an error.
Agent
const Agent = require('socks5-http-client/lib/Agent');
import { Agent } from 'socks5-http-client/lib/Agent';
The `Agent` constructor for integrating with `http.request` or deprecated libraries like `request` is found in a sub-path and is CommonJS only.
get
const shttp = require('socks5-http-client'); shttp.get('http://example.com', () => {});
const { get } = require('socks5-http-client');
The main client object `shttp` is a default-like export; methods like `get` are accessed directly on the `shttp` object, not destructured.

This example demonstrates how to make a basic HTTP GET request through a SOCKS5 proxy configured via environment variables, logging the initial part of the response body.

const shttp = require('socks5-http-client'); const SOCKS_HOST = process.env.SOCKS_HOST ?? 'localhost'; const SOCKS_PORT = parseInt(process.env.SOCKS_PORT ?? '1080', 10); shttp.get({ hostname: 'www.example.com', path: '/', socksHost: SOCKS_HOST, socksPort: SOCKS_PORT, // Optional SOCKS5 authentication // socksUsername: process.env.SOCKS_USERNAME, // socksPassword: process.env.SOCKS_PASSWORD, }, function(res) { res.setEncoding('utf8'); let data = ''; res.on('data', function(chunk) { data += chunk; }); res.on('end', function() { console.log('Received response:'); console.log(data.substring(0, 200) + '...'); // Log first 200 chars }); }).on('error', (e) => { console.error(`Request failed: ${e.message}`); });
Debug
Known issues
breakingThe package is severely unmaintained, with the last publish over eight years ago. It is known to be broken for Node.js versions above 14.17.0 due to internal compatibility issues, making it unsuitable for modern Node.js applications.
fix
Migrate to a actively maintained SOCKS5 client library for Node.js, such as `socks-proxy-agent` or explore `node-fetch` with a custom agent.
affects: >=1.0.4
securityBeing an unmaintained SOCKS5 client, this package may contain unpatched security vulnerabilities. SOCKS5 implementations have been susceptible to heap buffer overflows (e.g., CVE-2023-38545 in curl) and other issues. Using this library in production is a significant security risk.
fix
Do not use this package for new projects or in security-sensitive environments. Replace with a well-maintained and audited SOCKS5 client.
affects: >=1.0.0
gotchaThis client explicitly supports only HTTP requests, not HTTPS. For HTTPS traffic over SOCKS5, the separate `socks5-https-client` package (also unmaintained) or a modern alternative is required.
fix
For HTTPS, you must use a different library. If you need a combined solution, look for more comprehensive proxy agents.
affects: >=1.0.0
deprecatedThe recommended integration path for `socks5-http-client` involves passing its `Agent` to the `request` library, which itself was fully deprecated in February 2020. This indicates an outdated ecosystem reliance.
fix
Avoid integrating with the deprecated `request` library. If using this package, use it directly with Node's native `http` module or choose a modern HTTP client with SOCKS support.
affects: >=1.0.0
gotchaThis package is written exclusively in CommonJS (CJS) and does not support ES module (ESM) import syntax (`import ... from '...'`). Attempting to use ESM imports will lead to runtime errors in modern Node.js environments.
fix
Stick to `require()` syntax for importing this package. For modern applications, consider libraries that offer native ESM support.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'socks5-client'
The core dependency `socks5-client` was not installed correctly or Node.js cannot resolve its path.
fix
Ensure `npm install` has been run in your project root, or check your `NODE_PATH` environment variable if using global modules. This can also indicate issues with older Node.js versions.
TypeError: Cannot set property 'flowing' of undefined
This error often occurs in older stream implementations (like those in this package) when interacting with newer Node.js stream APIs or versions where internal stream properties have changed.
fix
This package is not compatible with modern Node.js versions (specifically, likely >14.17.0). Downgrade Node.js or, preferably, migrate to a current, maintained SOCKS5 client library.
RequestError: Error:connect ETIMEDOUT occurred with some socks5 server
The client could not establish a connection to the specified SOCKS5 proxy server, usually due to incorrect `socksHost`/`socksPort` settings, the proxy server not running, or network firewall rules.
fix
Verify that `socksHost` and `socksPort` are correct. Ensure the SOCKS5 proxy is running and accessible from the machine running the Node.js application. Check firewall rules.
Broken for node version above 14.17.0
Internal compatibility issues with Node.js changes post-14.17.0, likely related to networking or stream APIs.
fix
This package is abandoned and incompatible with recent Node.js versions. Upgrade to a modern, actively maintained SOCKS proxy agent (e.g., `https-proxy-agent` or `socks-proxy-agent`).
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
socks5-clientrequiredCore SOCKS5 socket implementation; also an old, unmaintained package.
Agent activity
4 hits · last 30 days
node
2
OpenAI (training)
1
Resources
socks5-http-client — npm install socks5-http-client · libregistry