Socks proxy for Node.js built-in fetch (undici) with bandwidth monitoring. Version 1.4.3 is a fork of fetch-socks that adds per-domain and global byte counters for sent/received data. Features SOCKS4/5 support, proxy chaining, HTTP tunnel connector, and TypeScript types. Actively maintained fork with experimental AI-assisted additions. Differentiators: unique bandwidth tracking capability not present in original fetch-socks; lightweight; uses undici dispatcher pattern.
npm install fetch-socks-bwNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a SOCKS5 dispatcher with bandwidth monitoring enabled, make a fetch request, and retrieve global stats.
Pass { connect: { enableStats: true } } as second argument to socksDispatcher.Ensure unique identification; consider extending if you need per-protocol stats.
Evaluate stability before deploying; consider using original fetch-socks if stats not needed.
Use undici's setGlobalDispatcher from 'undici' if available, or watch undici deprecations.
Use named import: import { socksDispatcher } from 'fetch-socks-bw'Start a SOCKS proxy like: ssh -D 1080 user@host or use a socks library.
npm install undici
Ensure fetch receives a valid URL string: await fetch('https://example.com', { dispatcher })