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

minitel-cloudflare-worker

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minitel-cloudflare-worker

A cloudflare worker for access through MiniPAVI

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
0
Weekly downloads
 
Created
Source

minitel-cloudflare-worker

[!NOTE] This is meant specifically for users of the minitel- ecosystem by me (immjs), and specifically for use with cloudflare workers

It can also be used by whomever needs to hook up MiniPAVI with a websocket based minitel server.

Opens up an HTTP(s) server for access through minipavi

[!NOTE] Unlike minitel-minipavi, the first argument to minitelFactory is already a duplex stream which means you need to enable nodejs compat You may access the request using the second argument, for instance to access the PAVI argument if you set providePAVI: true

Example

import { Minitel, TextNode } from 'minitel-standalone';
import { createMinipaviHandler } from 'minitel-cloudflare-worker';

export default createMinipaviHandler(
  (stream) => {
    const minitel = new Minitel(stream, {});
    minitel.appendChild(new TextNode('Hello world!', {}, minitel));

    minitel.renderToStream();

    setTimeout(() => stream.end(), 10_000);
  },
).then(() => console.log('MiniPavi handler ready!'));

Reference

createMinipaviHandler Function

Returns

A Promise that will resolve when the MiniPAVI handler will be up and running

Parameters

ParameterTypeDescription
minitelFactory(stream: Duplex) => anyA factory function to handle WebSocket connections.
optionsMinipaviHandlerOptionsConfiguration options for the handler.

MinipaviHandlerOptions

OptionTypeDescription
versionstringOptional. Specifies the version that will be given to MiniPAVI. Defaults to '1.0'.
providePavibooleanOptional. If true, provides the PAVI field as query parameters. Defaults to false.
provideDirectUrlbooleanOptional. If true, provides the DIRECTURL field as query parameters. Defaults to false.

Keywords

FAQs

Package last updated on 01 Sep 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