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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tcx-file-class

v1.0.42

Published

## Description

Downloads

20

Readme

tcx-file-class

Description

Reads a tcx file from garmin, polar, runtastic, tapiriik and introduce the class TcxFile wich has function to read all the values. It uses node-xml2js package for parsing the file.

Istallation

To install tcx-file-class use npm. npm install xml2js will do the job.

Usage

  • Import reference to TcxFile class like this:
import TcxFile from "tcx-file-class";

const tcxFile = new new TcxFile(fname, (err:string|undefined)=>{
    if (err){ //something went wrong
    }
});
  • If the class was created succesfully, the value tcxFile.isReady will be true.
  • Functions:
    • getId():string gives the Id of the file.
    • getSport():string gives a string with the Sport
    • getAuthor():Author|null give the Author class if any exists
    • getCreator():Creator|null give the Creator class if any exists
    • getLaps:Array<Lap> | Array<null> give the Laps class
    • save(filename: string, athleteId: number, zones: [number, number, number, number]|null, callback: (err: string) => void) save to the file (in json format), whith the proper athlete Id. The optional heart rate zones are used to calculate the time in zones.

Helper classes

These classes are created internally and is not recommended to create them by yourself.

Author

class Author {
    name: string;
    typeOfAuthor: string | any;
    build: string;
    langId: string;
    partNumber: string;
}

Creator

class Creator {
    name: string;
    typeOfCreator: string;
    productId: Number;
    unitId: Number;
    version: string;
    isRuntastic: boolean;
}

Laps

class Lap {
    startTime: string;
    averageHeartRateBpm: number;
    maximumHeartRateBpm: number;
    maximumSpeed: number;
    totalTimeSeconds: number;
    calories: number;
    distanceMeters: number;
    maxBikeCadence = consts.ERROR_NUMBER_VALUE;
    steps = consts.ERROR_NUMBER_VALUE;
    avgRunCadence = consts.ERROR_NUMBER_VALUE;
    maxRunCadence = consts.ERROR_NUMBER_VALUE;
    avgSpeed = consts.ERROR_NUMBER_VALUE;
    intensity = consts.ERROR_STRING_VALUE;
    trackPoints: Array<GpsPoint>;
    triggerMethod = consts.ERROR_STRING_VALUE;
}

GpsPoint

class GpsPoint {
    distanceMeters = consts.ERROR_NUMBER_VALUE;
    speed = consts.ERROR_NUMBER_VALUE;
    runCadence = consts.ERROR_NUMBER_VALUE;
    cadence = consts.ERROR_NUMBER_VALUE;
    heartRateBpm = consts.ERROR_NUMBER_VALUE;
    position: { latitudeDegrees: number, longitudeDegrees: number, altitudeMeters: number } =
        {
            latitudeDegrees: consts.ERROR_NUMBER_VALUE,
            longitudeDegrees: consts.ERROR_NUMBER_VALUE,
            altitudeMeters: consts.ERROR_NUMBER_VALUE
        }
    time = consts.ERROR_STRING_VALUE;

Consts used

const ERROR_NUMBER_VALUE = -1;
const ERROR_STRING_VALUE = "";

Tests

Package has number of tests. Package is written in Typescript, so if you want to change something do it in src\*.ts files.

Support

If something is wrong or you have something to propose please feel free to ask me (email me).