Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fetch-socks

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-socks

Socks proxy for Node builtin `fetch`

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
increased by24.43%
Maintainers
1
Weekly downloads
 
Created
Source

fetch-socks

npm package Test codecov

Socks proxy for Node builtin (also undici) fetch.

npm install fetch-socks

Usage Example

fetch http://example.com through socks5://[::1]:1080.

import { socksDispatcher } from "fetch-socks";

const dispatcher = socksDispatcher({
    proxy: {
        type: 5,
        host: "::1",
        port: 1080,
    },
});

const response = await fetch("https://example.com", { dispatcher });
console.log(response.status);
console.log(await response.text());

fetch through proxy chain with two SOCKS proxies.

import { socksDispatcher } from "fetch-socks";

const dispatcher = socksDispatcher({
    proxy: [{
        type: 5,
        host: "::1",
        port: 1080,
    }, {
        type: 5,
        host: "::1",
        port: 1081,
        //userId: "foo",
        //password: "bar",
	}],
    // set some TLS options
    connect: {
        rejectUnauthorized: false,
    },
});

const response = await fetch("https://example.com", { dispatcher });

Keywords

FAQs

Package last updated on 29 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc