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

@tex0l/ctrk-parser

v0.1.0

Published

TypeScript parser for Yamaha Y-Trac CTRK telemetry files

Readme

@tex0l/ctrk-parser

TypeScript parser for Yamaha Y-Trac CTRK telemetry files.

Features

  • Platform-agnostic: Works in both Node.js and browsers (no Node.js Buffer API)
  • Zero runtime dependencies: Parser has no npm dependencies
  • Strict TypeScript: Full type safety with strict mode enabled
  • Byte-for-byte compatible: Matches Python reference implementation
  • Comprehensive tests: Full unit test coverage with Vitest

Installation

npm install @tex0l/ctrk-parser

Usage

Import the parser

import {
  BufferReader,
  Calibration,
  validateMagic,
  parseFinishLine,
  parseCan0x0209,
  // ... other exports
} from '@tex0l/ctrk-parser';

Parse a CTRK file

// In Node.js
import { readFileSync } from 'fs';
const data = new Uint8Array(readFileSync('session.CTRK'));

// In browser
const response = await fetch('session.CTRK');
const arrayBuffer = await response.arrayBuffer();
const data = new Uint8Array(arrayBuffer);

// Validate magic
if (!validateMagic(data.slice(0, 4))) {
  throw new Error('Invalid CTRK file');
}

// Parse finish line
const finishLine = parseFinishLine(data.slice(0, 500));
console.log('Finish line:', finishLine);

// Use BufferReader for binary parsing
const reader = new BufferReader(data);
const rpm = reader.readUInt16BE(); // Read big-endian uint16

Calibrate raw values

import { Calibration } from '@tex0l/ctrk-parser';

const rpm = Calibration.rpm(25600); // 10000 RPM
const speed = Calibration.wheelSpeedKmh(6400); // 360.0 km/h
const lean = Calibration.lean(12000); // 30.0 degrees

API Reference

BufferReader

Platform-agnostic binary parser using Uint8Array and DataView.

class BufferReader {
  constructor(data: Uint8Array);
  readUInt8(): number;
  readUInt16LE(): number;
  readUInt16BE(): number;
  readUInt32LE(): number;
  readFloat64LE(): number;
  readBytes(length: number): Uint8Array;
  peekUInt8(offset: number): number;
  indexOf(pattern: Uint8Array, startOffset?: number): number;
  // ... more methods
}

Calibration

Static methods for converting raw sensor values to engineering units.

class Calibration {
  static rpm(raw: number): number;
  static wheelSpeedKmh(raw: number): number;
  static throttle(raw: number): number;
  static brake(raw: number): number;
  static lean(raw: number): number;
  static pitch(raw: number): number;
  static acceleration(raw: number): number;
  static temperature(raw: number): number;
  static fuel(raw: number): number;
  static gpsSpeedKmh(knots: number): number;
}

CAN Handlers

Functions for parsing CAN message payloads.

parseCan0x0209(data: Uint8Array, state: ChannelState): void; // RPM, Gear
parseCan0x0215(data: Uint8Array, state: ChannelState): void; // Throttle, Controls
parseCan0x023e(data: Uint8Array, state: ChannelState, fuelAcc: { value: number }): void; // Temp, Fuel
parseCan0x0250(data: Uint8Array, state: ChannelState): void; // Acceleration
parseCan0x0258(data: Uint8Array, state: ChannelState): void; // Lean, Pitch
parseCan0x0260(data: Uint8Array, state: ChannelState): void; // Brake
parseCan0x0264(data: Uint8Array, state: ChannelState): void; // Wheel Speed
parseCan0x0268(data: Uint8Array, state: ChannelState): void; // ABS

Header Parsing

validateMagic(data: Uint8Array): boolean;
findDataStart(reader: BufferReader): number;
parseFinishLine(data: Uint8Array): FinishLine | null;

Finish Line

sideOfLine(finishLine: FinishLine, lat: number, lng: number): number;
crossesLine(
  finishLine: FinishLine,
  lat1: number,
  lng1: number,
  lat2: number,
  lng2: number
): boolean;

Development

# Install dependencies
npm install

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Type check
npm run typecheck

# Lint
npm run lint

# Format
npm run format

# Build
npm run build

License

MIT