Socks proxy for Node.js builtin `fetch` and `WebSocket`, leveraging Undici's dispatcher system. Supports SOCKS4, SOCKS5, proxy chaining, and TLS upgrades. TypeScript types included. Currently at v1.3.3, actively maintained. Compared to alternatives like `socks` or `socks-proxy-agent`, it integrates seamlessly with modern Node.js fetch and WebSocket APIs without monkey-patching.
npm install fetch-socksNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: creating a SOCKS5 dispatcher and making an HTTPS fetch through it.
Use Symbol.for('undici.globalDispatcher.1') for undici <=7, and Symbol.for('undici.globalDispatcher.2') for undici >=8.Ensure Node.js 18+ with --experimental-fetch flag pre-21, or use undici explicitly.
If you intend to require a proxy, validate proxies.length > 0 before calling socksDispatcher.
Stay updated with release notes; consider pinning undici to a known working version.
Use dynamic import: const { socksDispatcher } = await import('fetch-socks');Check undici version and use correct symbol: 'undici.globalDispatcher.1' for <=7, 'undici.globalDispatcher.2' for >=8.
Start the SOCKS proxy server or verify host/port configuration.
Use Node 18+ with --experimental-fetch, or install undici and import fetch from 'undici'.
No dependency data recorded yet.