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

@hotlap.ai/telemetry

v1.0.0

Published

High-performance iRacing SDK for Bun - telemetry parsing and live data

Downloads

125

Readme

@hotlap.ai/telemetry

High-performance iRacing telemetry SDK for Bun. Parse IBT telemetry files and stream live data from iRacing via Windows shared memory.

Features

  • IBT File Parsing - Read and analyze iRacing telemetry binary files (.ibt)
  • Live Telemetry - Stream real-time data from iRacing via Windows shared memory (FFI)
  • WebSocket Server - Built-in telemetry server for real-time data streaming
  • Full TypeScript Support - Complete type definitions for all APIs
  • High Performance - Optimized binary parsing with minimal allocations

Requirements

  • Bun >= 1.0.0
  • Windows (for live telemetry features)
  • iRacing (for live telemetry)

Installation

bun add @hotlap.ai/telemetry

Usage

Parse IBT Files

import { IBT } from '@hotlap.ai/telemetry';

const ibt = new IBT();
await ibt.open('./telemetry.ibt');

// Get session info
const weekendInfo = ibt.getSessionInfo('WeekendInfo');
console.log(`Track: ${weekendInfo.TrackDisplayName}`);

// Read telemetry data
const speed = ibt.get('Speed', 0); // Get speed at tick 0
const allSpeeds = ibt.getAll('Speed'); // Get all speed values

// Iterate through records
for (let i = 0; i < ibt.recordCount; i++) {
  const lap = ibt.get('Lap', i);
  const throttle = ibt.get('Throttle', i);
  const brake = ibt.get('Brake', i);
}

Live Telemetry

import { createIRSDK } from '@hotlap.ai/telemetry';

const ir = createIRSDK();

// Connect to iRacing
const connected = await ir.startup();
if (!connected) {
  console.error('Failed to connect to iRacing');
  process.exit(1);
}

// Read live telemetry
setInterval(() => {
  if (ir.isConnected) {
    ir.freezeVarBufferLatest();

    const speed = ir.get('Speed');
    const rpm = ir.get('RPM');
    const gear = ir.get('Gear');

    console.log(`Speed: ${speed}, RPM: ${rpm}, Gear: ${gear}`);

    ir.unfreezeVarBufferLatest();
  }
}, 16); // ~60Hz

// Cleanup on exit
process.on('SIGINT', () => {
  ir.shutdown();
  process.exit(0);
});

WebSocket Telemetry Server

import { spawn } from 'bun';

// Start the telemetry server
const server = spawn(['bun', 'run', 'server'], {
  cwd: './node_modules/@hotlap.ai/telemetry',
});

// Connect from client
const ws = new WebSocket('ws://127.0.0.1:32100/ws');

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);

  switch (msg.type) {
    case 'session_info':
      console.log(`Track: ${msg.data.trackDisplayName}`);
      break;
    case 'telemetry':
      console.log(`Speed: ${msg.data.speed}`);
      break;
    case 'lap_change':
      console.log(`Lap ${msg.data.fromLap} completed: ${msg.data.lapTime}`);
      break;
  }
};

API Reference

IBT Class

Parse and read iRacing telemetry binary files.

| Method | Description | |--------|-------------| | open(path) | Open an IBT file asynchronously | | get(varName, tick) | Get a telemetry value at a specific tick | | getAll(varName) | Get all values for a telemetry variable | | getSessionInfo(key) | Get parsed session info by key | | getRawSessionInfo() | Get raw YAML session info string |

| Property | Description | |----------|-------------| | recordCount | Number of telemetry records | | sessionLapCount | Number of laps in session | | tickRate | Telemetry sample rate (typically 60Hz) | | varHeaderNames | List of available telemetry variables |

IRSDK Class

Connect to iRacing and read live telemetry data.

| Method | Description | |--------|-------------| | startup() | Connect to iRacing shared memory | | shutdown() | Disconnect and cleanup | | get(varName) | Get current value of a telemetry variable | | getSessionInfo(key) | Get parsed session info by key | | freezeVarBufferLatest() | Freeze telemetry buffer for consistent reads | | unfreezeVarBufferLatest() | Unfreeze telemetry buffer |

| Property | Description | |----------|-------------| | isConnected | Whether connected to iRacing | | isInitialized | Whether SDK is initialized | | sessionInfoUpdate | Session info update counter |

Broadcast Commands

Control iRacing camera, replay, and more:

ir.camSwitchPos(position, group, camera);
ir.camSwitchNum(carNumber, group, camera);
ir.replaySetPlaySpeed(speed, slowMotion);
ir.replaySearch(searchMode);
ir.chatCommand(chatCommandMode);
ir.pitCommand(pitCommandMode, variable);

Common Telemetry Variables

| Variable | Type | Description | |----------|------|-------------| | Speed | float | Vehicle speed (m/s) | | RPM | float | Engine RPM | | Gear | int | Current gear (-1=R, 0=N, 1-6=gears) | | Throttle | float | Throttle position (0-1) | | Brake | float | Brake position (0-1) | | Clutch | float | Clutch position (0-1) | | SteeringWheelAngle | float | Steering angle (radians) | | Lap | int | Current lap number | | LapDistPct | float | Lap completion percentage (0-1) | | LapCurrentLapTime | float | Current lap time (seconds) | | SessionTime | float | Session time (seconds) | | FuelLevel | float | Fuel remaining (liters) | | OilTemp | float | Oil temperature (C) | | WaterTemp | float | Water temperature (C) |

See iRacing SDK documentation for the complete list of variables.

Scripts

bun run build        # Build the library
bun run build:server # Build standalone telemetry server executable
bun run server       # Run telemetry WebSocket server
bun run dev          # Run CLI in watch mode
bun run test         # Run tests
bun run bench        # Run benchmarks

License

MIT - see LICENSE

Contributing

See CONTRIBUTING.md for guidelines.