//#region src/enums.d.ts /** Unit system options. */ declare enum UnitSystem { Imperial = 0, Metric = 1 } //#endregion //#region src/types.d.ts /** * Binary input accepted by {@link parse}. * * `Blob` also covers the browser `File` object. */ type BinaryInput = ArrayBuffer | Uint8Array | Blob; /** A range of values from min to max (inclusive). */ interface ValueRange { min: number; max: number; } /** * The configuration of the parser. * Supplying ranges will output values in the specified unit system (metric or imperial). * Failing to do so will output values in percentage (slider position). */ interface Configuration { unitSystem: UnitSystem; springs?: { stiffness?: { front: ValueRange; rear: ValueRange; }; rideHeight?: { front: ValueRange; rear: ValueRange; }; }; aero?: { front: ValueRange; rear: ValueRange; }; } /** * The parsed representation of an upgrade field. * Contains the raw value, the currently selected upgrade, and the list of available upgrades. */ interface UpgradeField { raw: number; selected: string; options: string[]; } /** * The parsed representation of a tuning field. * Contains the raw value, in-game value, unit, and range of the tuning field. */ interface TuningField { raw: number; value: number; unit: string | null; range: ValueRange; } /** * The parsed representation of a Forza tuning file. */ interface ForzaTune { ordinal: number; engine: { intake: UpgradeField; intakeManifold: UpgradeField | null; fuelSystemOrCarburetor: UpgradeField; ignition: UpgradeField; exhaust: UpgradeField; camshaft: UpgradeField; valves: UpgradeField; displacement: UpgradeField; pistons: UpgradeField; singleTurbo: UpgradeField | null; twinTurbo: UpgradeField | null; centrifugalSupercharger: UpgradeField | null; supercharger: UpgradeField | null; intercooler: UpgradeField; oilCooling: UpgradeField; flywheel: UpgradeField; restrictorPlate: UpgradeField | null; }; drivetrain: { clutch: UpgradeField; transmission: UpgradeField; driveline: UpgradeField; differential: UpgradeField; }; platform: { brakes: UpgradeField; springsAndDampers: UpgradeField; frontAntiRollBar: UpgradeField; rearAntiRollBar: UpgradeField; weightReduction: UpgradeField; chassisReinforcement: UpgradeField; }; conversions: { engineSwap: UpgradeField; drivetrainSwap: UpgradeField; bodySwap: UpgradeField; }; tuning: { tyrePressure: { front: TuningField; rear: TuningField; }; gearing: { finalDrive: TuningField; ratios: TuningField[]; }; alignment: { camber: { front: TuningField; rear: TuningField; }; toe: { front: TuningField; rear: TuningField; }; caster: TuningField; }; antiRollBars: { front: TuningField; rear: TuningField; }; springs: { stiffness: { front: TuningField; rear: TuningField; }; rideHeight: { front: TuningField; rear: TuningField; }; }; damping: { reboundStiffness: { front: TuningField; rear: TuningField; }; bumpStiffness: { front: TuningField; rear: TuningField; }; }; aero: { front: TuningField; rear: TuningField; }; brakes: { balance: TuningField; pressure: TuningField; }; differential: { front: { acceleration: TuningField; deceleration: TuningField; }; rear: { acceleration: TuningField; deceleration: TuningField; }; balance: TuningField; }; }; } //#endregion //#region src/parse.d.ts /** * Parse a binary Forza tuning file into a typed {@link ForzaTune} object. * * Accepts `File`, `Blob`, `fetch` response (`await res.arrayBuffer()`), or `fs.readFile()` in * Node.js (`Uint8Array`). * * @example Browser * ```ts * import { parse } from 'forza-tuning-parser'; * * dropZone.addEventListener('drop', async (e) => { * const file = e.dataTransfer!.files[0]; * const tune = await parse(file); * }); * ``` * * @example Node.js * ```ts * import { readFile } from 'node:fs/promises'; * import { parse } from 'forza-tuning-parser'; * * const tune = await parse(await readFile('my.tune')); * ``` * * @throws {TypeError} if `input` is not a supported binary type. */ declare function parse(input: BinaryInput, config?: Configuration): Promise; //#endregion export { type BinaryInput, type ForzaTune, parse }; //# sourceMappingURL=index.d.mts.map