New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cloudflare-tcp-fetcher

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

cloudflare-tcp-fetcher

A Fetcher implementation using the Cloudflare TCP Sockets API.

  • 0.9.1
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-18.18%
Maintainers
1
Weekly downloads
 
Created
Source

cloudflare-tcp-fetcher

A Fetcher implementation using the Cloudflare TCP Sockets API.

Getting started

Install the package

npm install cloudflare-tcp-fetcher

Using the TcpFetcher class

You can re-use the TcpFetcher class until the worker is closed.

import { TcpFetcher } from "cloudflare-tcp-fetcher";

export default {
	async fetch(request: Request, env: never, ctx: ExecutionContext): Promise<Response> {
    const fetcher = new TcpFetcher();

    return fetcher.fetch(new Request("https://google.com", {
      method: "GET"
    }));
  }
}

Using the fetchUsingTcp function

You can also input the TcpFetcher in the init object to reuse a connection.

import { fetchUsingTcp } from "cloudflare-tcp-fetcher";

export default {
	async fetch(request: Request, env: never, ctx: ExecutionContext): Promise<Response> {
    return fetchUsingTcp("https://google.com", {
      method: "GET"
    });
  }
}

FAQs

Package last updated on 18 Feb 2024

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