tor-http
v1.0.0
Published
Route all Node.js HTTP(S) requests through Tor SOCKS5 proxy with auto-detection and graceful shutdown
Downloads
8
Maintainers
Readme
tor-http
Fully plug-and-play Node.js package to route all HTTP(S) requests through Tor SOCKS5 proxy.
Features
- Auto-detect Tor on Windows/macOS/Linux
- Auto-start Tor if not running
- Graceful shutdown on exit or signals
- Patch global
http/httpsagents - Single-request function (
torRequest) with retry logic - Custom
torrcsupport - Verbose logging toggle
- Robust error handling
Installation
npm install tor-http
const { initTor } = require('tor-http');
(async () => {
await initTor({ torrc: './mytorrc', verbose: true });
})();
const { torRequest } = require('tor-http');
(async () => {
const data = await torRequest('http://check.torproject.org', { retries: 3, verbose: true });
console.log(data);
})();
const { stopTor } = require('tor-http');
stopTor();