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

@moqtap/trace

v0.1.1

Published

MoQT session trace format — record, serialize, and analyze .moqtrace files

Readme

@moqtap/trace

Record, serialize, and analyze MoQT (Media over QUIC Transport) sessions using the .moqtrace binary format.

  • Binary .moqtrace format with CBOR encoding (compact, streamable, cross-language)
  • Configurable detail levels from control-only to full wire captures
  • Session recorder that wraps @moqtap/codec session state machines
  • Human-readable JSON export for debugging
  • Zero-copy streaming writer for large traces

Install

npm install @moqtap/trace @moqtap/codec

@moqtap/codec is a peer dependency — install it alongside @moqtap/trace.

Quick Start

Recording a session

import { createRecorder, writeMoqtrace } from '@moqtap/trace';
import { createDraft14SessionState } from '@moqtap/codec/draft14/session';

const recorder = createRecorder({
  protocol: 'moq-transport-14',
  perspective: 'client',
  detail: 'control',
});

// Wrap a session to auto-capture control messages and state transitions
const session = createDraft14SessionState({ codec: { draft: 'draft-ietf-moq-transport-14' }, role: 'client' });
const traced = recorder.wrapSession(session);

// Use `traced` instead of `session` — all send/receive calls are recorded
traced.send(clientSetupMessage);
traced.receive(serverSetupMessage);

// Manually record events the session layer doesn't see
recorder.recordStreamOpened(4n, 0, 0); // outgoing subgroup stream
recorder.annotate('connected', { relay: 'cdn.example.com' });

// Finalize and serialize
const trace = recorder.finalize();
const bytes = writeMoqtrace(trace); // → Uint8Array (.moqtrace binary)

Reading a trace file

import { readMoqtrace, readMoqtraceHeader } from '@moqtap/trace';

// Quick metadata peek (no event parsing)
const header = readMoqtraceHeader(bytes);
console.log(header.protocol);   // "moq-transport-14"
console.log(header.perspective); // "client"
console.log(header.detail);     // "control"

// Full parse
const trace = readMoqtrace(bytes);
for (const event of trace.events) {
  console.log(event.type, event.timestamp);
}

Streaming writer (for large traces)

import { createMoqtraceWriter } from '@moqtap/trace';

const writer = createMoqtraceWriter(header);
outputStream.write(writer.preamble());

for (const event of events) {
  outputStream.write(writer.writeEvent(event));
}

Detail Levels

| Level | What's recorded | |---|---| | control | Control messages only (setup, subscribe, publish, goaway) | | headers | + data stream headers (subgroup/fetch, object metadata) | | headers+sizes | + payload byte lengths | | headers+data | + full payload bytes | | full | + raw wire bytes (pre-decode) |

JSON Export

For human-readable debugging (not lossless — bigint/Uint8Array become strings):

import { traceToJSON } from '@moqtap/trace';

const json = traceToJSON(trace);
console.log(json);

File Format

See SPEC.md for the complete .moqtrace binary format specification.

License

MIT