irsdk-node
NodeJS bindings for the iRacing SDK. Aims to provide a thin barrier of entry to use the SDK from Node based apps. This repo just adds bindings for the current version of the SDK and is not a full node.js implementation. That would be a lot of fun (something like pyirsdk or iracing-sdk), but unfortunately I do not have the time atm :)
⚠️ BREAKING CHANGE! v4.0.0 updates all native dependencies to modern NodeJS API's, and as such the minimum Node version supported has been increased to v18. For v16 environments, please use the latest 3.x.x release (3.3.0)
Usage
import { IRacingSDK } from "irsdk-node";
const TIMEOUT = Math.floor((1 / 60) * 1000);
function loop(sdk: IRacingSDK): void {
if (sdk.waitForData(TIMEOUT)) {
const session = sdk.getSessionData();
const telemetry = sdk.getTelemetry();
loop(sdk);
} else {
}
}
if (await IRacingSDK.IsSimRunning()) {
const sdk = new IRacingSDK();
if (await sdk.ready()) {
sdk.autoEnableTelemetry = true;
loop(sdk);
}
}
Development commands
$ yarn build
$ yarn watch
$ yarn run-debug
$ yarn dump-data
$ yarn clean
$ yarn lint
Contributing
Everything should be quite straightforward, but as the project needs to be built via node-gyp + typescript there are a couple of different commands you need to considering your needs.