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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@irsdk-node/native

v5.1.0

Published

_Currently using **iRacing SDK v1.19**. You can see the latest version of the SDK [on the forums](https://forums.iracing.com/discussion/62/iracing-sdk/p1)._

Downloads

228

Readme

@irsdk-node/native

Currently using iRacing SDK v1.19. You can see the latest version of the SDK on the forums.

This is the native bindings package for irsdk-node. This provides near 1:1 bindings to the C++ iRacing SDK, and is consumed as a dependency of irsdk-node, which provides a handy little wrapper around the API to make it nicer to use and avoid boilerplating.

While you can use this package directly, it is highly recommended to use the irsdk-node package instead. Types for the data exposed via this package can be used independently via @irsdk-node/types as well.

Usage

Install as a dependency.

# Via npm..
$ npm install @irsdk-node/types

# Or yarn..
$ yarn add @irsdk-node/types

# Or pnpm..
$ pnpm add @irsdk-node/types

Then you can use the SDK bindings directly.

import { NativeSDK } from '@irsdk-node/native';
import {
    SessionData,
    TelemetryVarList,
    TelemetryVariable,
    BroadcastMessages,
    TelemetryCommand,
    } from '@irsdk-node/types';

const sdk = new NativeSDK();

// Try to start the SDK. This will return false if an iRacing session is not active.
//
// In cases where the SDK is not running, you would likely want to poll this fn
// so you can start grabbing data once a session starts.
if (!sdk.startSDK()) {
    console.log('iRacing not running');
    process.exit(0);
}

// Start telemetry.
sdk.broadcast(BroadcastMessages.TelemCommand, TelemetryCommand.Start);

// Grab data from the SDK.
const TICK_RATE = 1 / 60; // 60fps, the max
if (sdk.waitForData(TICK_RATE)) {
    // This is a YAML string of more static data. Every time this changes,
    // sdk.currDataVersion will be incremented by 1. -1 is the default value.
    //
    // This object is BIG. It is recommended to only fetch when currDataVersion
    // changes to avoid performance issues.
    const sessionData: SessionData = sdk.getSessionData();

    // Telemetry needs to be massaged using var.varType to their correct types,
    // for example, varType 4 (float32) should be parsed as Float32Array.
    //
    // See irsdk-node codebase for examples.

    // Returns ALL telemetry variables as a big object.
    const allTelemetry: TelemetryVarList = sdk.getTelemetryData();

    // Get just one telemetry variable by name or index. Usually by name.
    const incidentCount: TelemetryVariable<number[]> = sdk.getTelemetryVariable('PlayerCarMyIncidentCount');
}

// Close the SDK once you are done.
sdk.stopSDK();

Distribution

To ensure cross-compat between platforms, a mock SDK api is provided for non-windows platforms. This gets built on all supported platforms automatically during deployment via github actions. Node-gyp is used under the hood for building the node.js C++ module, with pre-build functionality provided by prebuildify.

Prebuildify also will automatically detect the platform and import the correct native module for the platform. If it doesn't exist, during installation it will attempt to build it.

Contributing

SDK

The SDK in its entirety lives in lib along with the node.js bindings class. Technically it is always at the 'latest version' of the sdk with regards to the telemetry and session data since those are just pure data, but for other API updates the latest sdk files can just be replaced within that directory to update to the latest (for example irsdk_client.h, irsdk_defines.h, etc.)

Generating types

This package contains a utility script for generating Typescript types based on the actual Telemetry values present during runtime. To do so you can run pnpm generate-types while you have iRacing running and connected to a server. This will generate a new .ts types file in the @irsdk-node/types package.

Please refer to the readme in the types package for more info.

Commands

These are the primary commands for package development.

# Build the package.
$ pnpm build

# Build only the typescript.
$ pnpm build:ts

# Build the C++ module.
$ pnpm build:cpp

# Run util script for generating typescript types
$ pnpm generate-types

# Clean the build directories
$ pnpm clean

# Lint package
$ pnpm lint

⚠️ C++ Build errors from prebuildify/node-gyp

If the C++ build fails with an error similar to:

gyp: /<path>/<to>/common.gypi not found (cwd: /<cwd>/<path>) while reading includes of binding.gyp...

Then try looking for your global node-gyp and prebuildify caches. On Windows, they should be somewhere around:

  • Node-gyp:
    • C:\Users\<YourUser>\AppData\Local\node-gyp
    • C:\Users\<YourUser>\AppData\Local\.node-gyp
  • Prebuildify:
    • C:\Users\<YourUser>\AppData\Local\Temp\prebuildify

Once cleared, you can try running pnpm clean && pnpm build again. Prebuildify and Node-GYP should then attempt to do a fresh install before attempting to build.