npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@webtransport-bun/webtransport

v0.3.0

Published

Production-focused WebTransport for Bun, Node, and Deno with datagrams and streams via a Rust napi-rs addon

Readme

@webtransport-bun/webtransport

Production-focused WebTransport for Bun, Node, and Deno: datagrams + streams, in-process server/client, backed by Rust wtransport via napi-rs.

Install

bun add @webtransport-bun/webtransport
npm i @webtransport-bun/webtransport
pnpm add @webtransport-bun/webtransport
yarn add @webtransport-bun/webtransport

Requirements

  • Runtime: Bun >= 1.3.9, Node (Node-API compatible runtime), Deno (npm + Node-API addon support)
  • Platforms: macOS (arm64, x64), Linux (x64), Windows (x64)

Quick Start

import { createServer, connect } from "@webtransport-bun/webtransport";

const server = createServer({
  port: 4433,
  tls: { certPem: "...", keyPem: "..." },
  onSession: async (session) => {
    for await (const d of session.incomingDatagrams()) {
      await session.sendDatagram(d);
    }
  },
});

// Hot-swap TLS leaf cert/key material without dropping existing sessions.
// New handshakes immediately use the new certificate.
// Transport config and bind-address changes still require rebuilding the server.
await server.updateCert({ certPem: "...next cert...", keyPem: "...next key..." });

// Or atomically replace the full TLS configuration, including hostname-specific SNI certs.
await server.updateTls({
  certPem: "...default cert...",
  keyPem: "...default key...",
  sni: [
    {
      serverName: "api.example.test",
      certPem: "...api cert...",
      keyPem: "...api key...",
    },
  ],
  unknownSniPolicy: "reject",
});

// Or manage the hostname map incrementally.
await server.upsertSniCert({
  serverName: "admin.example.test",
  certPem: "...admin cert...",
  keyPem: "...admin key...",
});
await server.setUnknownSniPolicy("default");
console.log(server.tlsSnapshot());

const session = await connect("https://127.0.0.1:4433", {
  tls: { insecureSkipVerify: true }, // dev only
});
await session.sendDatagram(new Uint8Array([1, 2, 3]));
session.close();

Troubleshooting

TLS hot-swap and SNI

  • updateCert() changes only the default server certificate/key.
  • updateTls() atomically replaces the default certificate/key, full SNI certificate map, and unknown-SNI policy.
  • replaceSniCerts() swaps the full SNI certificate map while preserving the default certificate/key and current unknown-SNI policy.
  • upsertSniCert() and removeSniCert() manage individual hostname mappings in place.
  • setUnknownSniPolicy() changes only unknown-SNI handling in place.
  • tlsSnapshot() returns sorted active SNI hostnames in canonical ASCII form plus the current unknown-SNI policy.
  • Wildcards are supported only as left-most single-label entries such as *.example.com; exact hostnames win over wildcards.
  • SNI hostnames are IDNA-normalized to canonical ASCII, so Unicode names are stored and matched by their punycode form.
  • Review configured Unicode hostnames for homograph/confusable risk; IDNA normalization makes names protocol-correct, not human-safe.
  • When tls.sni is configured, unknownSniPolicy defaults to "reject" for unknown hostnames.
  • Clients that do not send SNI still receive the default certificate.
  • tls.sni and unknownSniPolicy require a non-empty default server certificate/key.
  • Bind-address or transport-config changes still require rebuilding/restarting the server.

"Native addon not loaded"

Published npm packages and GitHub release artifacts include prebuilt binaries for darwin-arm64, darwin-x64, linux-x64, and win32-x64-msvc. A source checkout may only have whatever prebuilds were generated locally. If you see this error:

  • Ensure you are on a supported platform (macOS/Linux/Windows on supported arch).
  • Reinstall dependencies and rebuild native artifacts (npm i / pnpm i / yarn / bun install).
  • For development from source, run bun run build:native from the repo root.

Runtime compatibility mismatch

This package supports Bun, Node, and Deno on supported OS/arch targets. If import fails:

  • Confirm your runtime supports Node-API addon loading.
  • Confirm your platform matches published prebuilds (macOS arm64/x64, Linux x64, Windows x64).
  • If needed, build native locally from source (bun run build:native in this repo).

Docs

Full documentation: github.com/vmeansdev/webtransport-bun