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

deno-http-worker

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deno-http-worker

[![NPM version](https://img.shields.io/npm/v/deno-http-worker.svg?style=flat)](https://npmjs.org/package/deno-http-worker)

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33
decreased by-54.79%
Maintainers
1
Weekly downloads
 
Created
Source

deno-http-worker

NPM version

Similarly to deno-vm, deno-http-worker lets you securely spawn Deno http servers.

Usage

import { newDenoHTTPWorker } from 'deno-http-worker';

let worker = await newDenoHTTPWorker(
    `export default async function (req: Request): Promise<Response> {
        return Response.json({ ok: req.url })
    }`,
    { printOutput: true, runFlags: ["--alow-net"] }
);

let json = await worker.client
    .get("https://hello/world?query=param")
    .json();
console.log(json) // => { ok: 'https://hello/world?query=param' }

worker.terminate();

Internals

Deno-http-worker connects to the Deno process over a single Unix socket http2 connection to make requests. This is for performance and efficiency. As a result, the worker does not provide an address or url, but instead returns an instance of a got client that you can make requests with. This ensures that only the underlying http2.ClientHttp2Session is used to make requests.

If you need more advanced usage that cannot be covered by got, please open a ticket.

FAQs

Package last updated on 09 May 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