Home Reference Source

easy-fit

Parse your .FIT files easily, directly from JS. Written in ES6.

Install

$ npm install easy-fit --save

How to use

See in examples folder:

// Require the module
var EasyFit = require('./../dist/easy-fit.js').default;

// Read a .FIT file
var fs = require('fs');
fs.readFile('./example.fit', function (err, content) {

  // Create a EasyFit instance (options argument is optional)
  var easyFit = new EasyFit({
    force: true,
    speedUnit: 'km/h',
    lengthUnit: 'km',
    temperatureUnit: 'kelvin',
    elapsedRecordField: true,
    mode: 'cascade',
  });

  // Parse your file
  easyFit.parse(content, function (error, data) {

    // Handle result of parse method
    if (error) {
      console.log(error);
    } else {
      console.log(JSON.stringify(data));
    }

  });

});

API Documentation

new EasyFit(Object options)

Needed to create a new instance. options is optional, and is used to customize the returned object.

Allowed properties :

easyFit.parse(Buffer file, Function callback)

callback receives two arguments, the first as a error String, and the second as Object, result of parsing.

Contributors

Big thanks to Mikael Lofjärd for his early prototype. See CONTRIBUTORS.

License

MIT license; see LICENSE.

(c) 2016 by Pierre Jacquier