{"id":49530,"library":"tor-axios","title":"TorAxios","description":"A TypeScript library that wraps axios to route HTTP requests through the Tor network. Current stable version is 2.1.1. It provides a TorAxios class that automatically uses a SOCKS proxy (via Tor) for all requests, with optional control port integration to programmatically refresh the Tor session (get a new IP). Key differentiators: simple API, full TypeScript support, ability to extract httpAgent/httpsAgent for custom axios instances. Requires a running Tor daemon and axios >=1.0.0. Maintained actively.","status":"active","version":"2.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/pelogvc/tor-axios","tags":["javascript","typescript"],"install":[{"cmd":"npm install tor-axios","lang":"bash","label":"npm"},{"cmd":"yarn add tor-axios","lang":"bash","label":"yarn"},{"cmd":"pnpm add tor-axios","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; used to make HTTP requests through Tor","package":"axios","optional":false}],"imports":[{"note":"Default export is not available; always use named import. ESM-only since v2.","wrong":"const TorAxios = require('tor-axios').TorAxios","symbol":"TorAxios","correct":"import { TorAxios } from 'tor-axios'"},{"note":"CommonJS 'require' must destructure named export; default import not available.","wrong":"const TorAxios = require('tor-axios')","symbol":"TorAxios","correct":"const { TorAxios } = require('tor-axios')"},{"note":"TypeScript type import works for type-only usage.","wrong":"","symbol":"TorAxios","correct":"import type { TorAxios } from 'tor-axios'"}],"quickstart":{"code":"import { TorAxios } from 'tor-axios';\n\nconst tor = new TorAxios({\n  ip: 'localhost',\n  port: 9050,\n});\n\nconst response = await tor.get('http://icanhazip.com');\nconsole.log(response.data);","lang":"typescript","description":"Basic usage: create TorAxios instance with default Tor SOCKS proxy and make a GET request."},"warnings":[{"fix":"Use named import: import { TorAxios } from 'tor-axios' instead of import TorAxios from 'tor-axios'.","message":"Version 2.0.0 dropped CommonJS support and removed default export.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Run npm install axios alongside tor-axios.","message":"Axios is a peer dependency; must be installed separately.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure Tor is installed and running (e.g., brew services start tor or sudo systemctl start tor).","message":"Tor daemon must be running and SOCKS proxy port must be open.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set controlPort and controlPassword in TorSetupOptions, and enable ControlPort in torrc.","message":"Control port and password are required for refreshSession() to work.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use with caution in shared environments; consider running dedicated Tor instance.","message":"refreshSession() sends a NEWNYM signal to Tor; may affect other Tor users if using shared instance.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':74 '2.1.1':20 'abil':59 'activ':76 'api':55 'automat':27 'axio':7,65,73 'class':25 'control':39 'current':16 'custom':64 'daemon':71 'differenti':53 'extract':61 'full':56 'get':48 'http':10 'httpagent/httpsagent':62 'instanc':66 'integr':41 'ip':51 'javascript':77 'key':52 'librari':4 'maintain':75 'network':15 'new':50 'option':38 'port':40 'programmat':43 'provid':22 'proxi':31 'refresh':44 'request':11,36 'requir':67 'rout':9 'run':69 'session':47 'simpl':54 'sock':30 'stabl':17 'support':58 'tor':14,33,46,70 'toraxio':1,24 'typescript':3,57,78 'use':28 'version':18 'via':32 'wrap':6","created_at":"2026-06-07T17:02:14.471608+00:00","updated_at":"2026-06-07T17:02:14.471608+00:00","problems":[{"fix":"Start Tor (tor &) or check port configuration.","cause":"Tor daemon is not running or SOCKS proxy port is incorrect.","error":"Error: connect ECONNREFUSED 127.0.0.1:9050"},{"fix":"Generate hash with tor --hash-password <your_password> and update torrc.","cause":"ControlPassword provided does not match the hashed password in torrc.","error":"Error: ControlPort authentication failed: password did not match HashedControlPassword"},{"fix":"Use const { TorAxios } = require('tor-axios');","cause":"Using default import instead of named import (CommonJS).","error":"TypeError: tor_axios_1.TorAxios is not a constructor"},{"fix":"Run npm install tor-axios axios and ensure import path is correct.","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'tor-axios'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/pelogvc/tor-axios#readme","github":"https://github.com/pelogvc/tor-axios","docs":null,"changelog":null,"pypi":null,"npm":"tor-axios","openapi_spec":null,"status_page":null,"smithery":null,"categories":["security","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}