{"id":17260,"library":"http-proxy-to-socks","title":"HTTP Proxy to SOCKS Converter (CLI)","description":"http-proxy-to-socks (hpts) is a command-line interface (CLI) tool for Node.js designed to convert a SOCKS proxy into an HTTP proxy. This utility is particularly useful in environments where applications or clients only support HTTP proxy configurations, but the available upstream proxy is SOCKS-based. It operates by launching a local HTTP proxy server that intercepts HTTP requests and transparently forwards them through a user-specified SOCKS proxy. The package is currently at version 1.1.4, with its last update approximately six years ago, indicating it is likely in an abandoned or unmaintained state. While it fulfills a specific niche, users should be aware of its age and lack of recent updates. Key differentiators include its simplicity and direct command-line utility for this specific proxy conversion task, contrasting with more comprehensive proxy agents or libraries that might offer programmatic integration.","status":"abandoned","version":"1.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/oyyd/http-proxy-to-socks","tags":["javascript","socks","http proxy","converting proxy"],"install":[{"cmd":"npm install http-proxy-to-socks","lang":"bash","label":"npm"},{"cmd":"yarn add http-proxy-to-socks","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-proxy-to-socks","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a command-line interface (CLI) tool, not a library for programmatic import. Its primary usage is via the `hpts` command after global installation. Attempting to `import` or `require` modules directly from the package will result in errors as no public API is exposed.","wrong":"import { hpts } from 'http-proxy-to-socks'","symbol":"hpts (CLI command)","correct":"npm install -g http-proxy-to-socks\nhpts -s <SOCKS_HOST>:<SOCKS_PORT> -p <HTTP_PROXY_PORT>"}],"quickstart":{"code":"import { exec } from 'child_process';\n\nconst socksHost = '127.0.0.1'; // Replace with your SOCKS proxy host\nconst socksPort = 1080;      // Replace with your SOCKS proxy port\nconst httpProxyPort = 8080;  // Port for the HTTP proxy hpts will create\n\nconst command = `hpts -s ${socksHost}:${socksPort} -p ${httpProxyPort}`;\n\nconsole.log(`Starting http-proxy-to-socks: ${command}`);\n\nconst hptsProcess = exec(command, (error, stdout, stderr) => {\n  if (error) {\n    console.error(`exec error: ${error}`);\n    return;\n  }\n  if (stdout) console.log(`stdout: ${stdout}`);\n  if (stderr) console.error(`stderr: ${stderr}`);\n});\n\nhptsProcess.stdout.on('data', (data) => {\n  console.log(`hpts output: ${data.toString().trim()}`);\n});\n\nhptsProcess.stderr.on('data', (data) => {\n  console.error(`hpts error: ${data.toString().trim()}`);\n});\n\n// Keep the process alive for a few seconds to demonstrate. In a real app,\n// you'd manage its lifecycle more robustly or run it as a daemon.\nsetTimeout(() => {\n  console.log('Stopping hpts process...');\n  hptsProcess.kill();\n}, 10000); // Stop after 10 seconds for demonstration","lang":"typescript","description":"This quickstart demonstrates how to programmatically execute the `hpts` command-line tool using Node.js's `child_process` module to set up an HTTP proxy on port 8080, forwarding traffic through a SOCKS proxy running on 127.0.0.1:1080. It simulates typical CLI usage for integration or testing."},"warnings":[{"fix":"Use `npm install -g http-proxy-to-socks` and then execute the `hpts` command directly from the terminal or through `child_process.exec`/`spawn` in Node.js applications.","message":"The `http-proxy-to-socks` package is solely a command-line interface (CLI) tool. It is not designed to be imported or used programmatically as a library within another Node.js application. Attempts to `require()` or `import` its modules will fail as it does not expose a public API. Users must install it globally or call its executable via `child_process`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Evaluate newer, actively maintained alternatives like `socks-proxy-agent` or `https-socks-proxy` if programmatic integration is needed, or explore other CLI-based proxy conversion tools if maintenance is a concern. For critical systems, consider the risks of using unmaintained software.","message":"The package has not been updated in approximately six years (since version 1.1.4). This indicates it is likely unmaintained or abandoned. While its core functionality may still work, it might not receive security patches, bug fixes, or updates for modern Node.js versions or evolving proxy standards.","severity":"deprecated","affected_versions":"<=1.1.4"},{"fix":"Verify your SOCKS proxy server status and configuration (e.g., `socks://127.0.0.1:1080`) before launching `hpts`. Check firewall rules and network connectivity between `hpts` and the SOCKS server.","message":"It is crucial to ensure that the specified SOCKS proxy (`-s`) is actively running and accessible at the provided host and port before starting `hpts`. If the SOCKS proxy is unavailable or misconfigured, `hpts` will not be able to establish its HTTP proxy service correctly, leading to connection failures for clients using the HTTP proxy.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Choose a different, available port for the HTTP proxy. For example, `hpts -s 127.0.0.1:1080 -p 8081`.","cause":"The specified HTTP proxy port (`-p`) is already in use by another application on the system.","error":"Error: listen EADDRINUSE: address already in use :::8080"},{"fix":"Ensure your SOCKS proxy (e.g., `socks://127.0.0.1:1080`) is running and accessible from where `hpts` is executed. Double-check the host and port in the `-s` argument for typos. Check local firewall settings.","cause":"The `hpts` tool failed to connect to the specified SOCKS proxy. This usually means the SOCKS proxy server is not running, is listening on a different address/port, or a firewall is blocking the connection.","error":"Error: connect ECONNREFUSED 127.0.0.1:1080 - Local (0.0.0.0:xxxx)"},{"fix":"Install the package globally using `npm install -g http-proxy-to-socks`. If it's still not found, verify npm's global bin directory is in your system's PATH.","cause":"The `http-proxy-to-socks` package was not installed globally, or its binary path is not in the system's PATH environment variable.","error":"hpts: command not found"}],"ecosystem":"npm","meta_description":null}