Giter VIP home page Giter VIP logo

fit-writer's Introduction

Fit Writer

A TypeScript-powered library to write FIT files.

Table of Contents

Features

fit-writer uses the pairing of definition messages with one or more data messages (the foundation of the FIT format) to drive the API design.

const file = new FitFile();

const header = new FitRecordDefinition<[
    FitFields.file_id.type, FitFields.file_id.manufacturer,
    FitFields.file_id.product, FitFields.file_id.serial_number,
]>(
    FitFields.file_id.type.createDefinition(),
    FitFields.file_id.manufacturer.createDefinition(),
    FitFields.file_id.product.createDefinition(),
    FitFields.file_id.serial_number.createDefinition(),
);
file.add(header);
file.add(header.create(
    FitFields.file_id.type.activity(),
    FitFields.file_id.manufacturer.development(),
    new FitNumber(22),
    new FitNumber(1234),
));
Re-use the same definition messages

Provide a single definition message, then create multiple data messages from that definition.

Strongly typed definition and data messages

The parameters when creating a new FitRecordDefinition or creating data messages must match the defined format. This means that your IDE and compiler can both complain if you don’t provide all the fields defined, or if the fields aren’t in the correct order.

Field values are strongly typed

You can’t pass a string to a number field. Enum fields require specific members.

Record structure is enforced

You can’t use fields only allowed in the file_id record inside activity records.

Editor support for parameters

Your editor may be able to describe the desired parameters, and perform smart autocompletion with variables that match the desired types.

Example

Example of autocompletion in an IDE

fit-writer's People

Contributors

codelenny avatar

Watchers

 avatar  avatar

fit-writer's Issues

Lint files

  • Fields match message type (per record)
  • File (and each sub-file) starts with file_id

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.