Sports Lib API - v23.12.1
    Preparing search index...

    Class SportsLib

    Primary facade for importing activities and routes, exporting route files, and restoring Sports Lib's native JSON representation.

    Index
    • Converts a FIT course file to a GPX route file.

      Parameters

      Returns Promise<string>

    • Converts a GPX route file to a FIT course file.

      Parameters

      • gpxString: string
      • OptionaldomParser: any

        custom DOMParser (case of NodeJs usage)

      • Optionaloptions: RouteParsingOptions

      Returns Promise<ArrayBuffer>

    • Exports a single first-class route as a FIT course file. Preserves supported specific route sports through standard FIT sport/sub-sport pairs.

      Parameters

      Returns Promise<ArrayBuffer>

    • Parses and returns an event using FIT format. Credible session timestamps remain authoritative without duration summaries. Record-based date recovery is scoped to the session; whole-file record bounds are used only when there is a sole session. Pool length endpoints and generated samples respect the resolved lap/session bounds and active timer limits. Explicit non-activity file types are rejected; missing file types retain legacy activity recovery. Completed activity_summary files require recorded sessions and do not use sessionless recovery. Use importRoutesFromFit for FIT courses.

      Parameters

      Returns Promise<EventInterface>

    • Restores an event from Sports Lib's native JSON format.

      Finite explicit stats are preserved except terrain summaries excluded for Diving activities. Legacy null or non-finite scalar summaries are skipped without changing null stream gaps. Missing pace, swim-pace, and grade-adjusted-pace summaries are hydrated from compatible speed summaries on the event, its activities, and their laps.

      Parameters

      Returns EventInterface

      The restored event with canonical stat keys and additive speed-derived summaries.

    • Parses and returns an event using Suunto format. Mixed-sport pace calibration must belong to the individual leg; unscoped header speed-zone boundaries are retained only for files with one resolved sport type. Retains source endurance summaries and supports selective streams. EnduranceDistance source values are in metres and are retained without scaling.

      Parameters

      Returns Promise<EventInterface>

    • Parses and returns first-class routes using FIT course format. Recognized sport/sub-sport pairs restore specific route sports; other pairs retain the parent sport.

      Parameters

      Returns Promise<RouteFileInterface>