Closed MichaelLiss closed 4 years ago
Just so you know... I do have code that uses your object and successfully parses a file that is read from the hard drive - so I know your object works when reading files from hard drive. :-)
var fName = path.join(__dirname, './4861335825.fit');
fs.readFile(fName, function (err, content) {
console.log('reading fit file - content',content);
// Create a FitParser instance (options argument is optional)
var fitParser = new FitParser({
force: true,
speedUnit: 'km/h',
lengthUnit: 'km',
temperatureUnit: 'kelvin',
elapsedRecordField: true,
mode: 'cascade',
});
// Parse your file
fitParser.parse(content, function (error, data) {
I am going down the right path now;
const buf1 = Buffer.from(binary, 'utf8');
var data = await internalParse(buf1);
will get me into your parser... now I am getting this:
stack:"TypeError: Cannot read property 'globalMessageNumber' of undefined
at readRecord (d:\Code\Udemy\instanttiming\node_modules\fit-file-parser\dist\binary.js:332:60)
I see this in the binary.js file:
// TODO: handle compressed header ((recordHeader & 128) == 128)
could a compressed header be the reason for the error ?
I thought it might be that utf8 was the wrong encoding... so I tried this:
var encoding = 'utf8';
encoding = 'utf16le';
const buf1 = Buffer.from(binary, encoding);
But that makes the parser have a wrong fileTypeString:
Hey. Could you try the option force ? That should allow that block of code to exacute.
Sorry I am ooo and might take a few to reply properly.
Thanks in advance for reporting those issues.
On Fri, 1 May 2020, 14:42 MrLister, notifications@github.com wrote:
I thought it might be that utf8 was the wrong encoding... so I tried this:
var encoding = 'utf8'; encoding = 'utf16le'; const buf1 = Buffer.from(binary, encoding);
But that makes the parser have a wrong fileTypeString:
[image: utf16le] https://user-images.githubusercontent.com/39492750/80806058-78f1d700-8b6e-11ea-835d-bca3d6d63d74.PNG
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jimmykane/fit-parser/issues/15#issuecomment-622372603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVX42JPLMMEA2SRDSDMELRPK7UJANCNFSM4MWWVJ7A .
I have the exact same code on other lib , that consumers this lib (fit parser) but also extends for gpx and tcx are you interested ?
On Fri, 1 May 2020, 16:12 MrLister, notifications@github.com wrote:
Closed #15 https://github.com/jimmykane/fit-parser/issues/15.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jimmykane/fit-parser/issues/15#event-3293295675, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVX43EVOTNOBZMZMSUZ53RPLKENANCNFSM4MWWVJ7A .
I need the information that the activity file provides and the FIT file format is the only format that is available for activity file download.
Additionally, the fit file format is WAY smaller than a gpx or tcx,
Lastly, parsing it (much thanks to your parser) is super quick ... so I can just parse on demand when I need to get data
so the short answer is : thanks, but no. :-)
Hi,
I am trying to use your fit file parser and ran into a little issue I am hoping you will be able to shed some light on.
I am using the garmin health-api and downloading a FIT file directly through the REST api. Here is an example call
Of course there is a bunch of stuff (oAuth, headers and callbacks) that needs to occur before you can download the fit file, but rest assured, I have worked with Garmin to get all of the "rest of the stuff" hammered out and I am getting FIT file data from the REST api.
Here is what the fit file data looks like when I view it in my debugger:
Here is the code where I am using your object to directly parse the downloaded data from the REST call:
When I try to read this data using your object I get the following error:
My question to you: Is there a way I can simply pass that data to your object for parsing? or do I need to do something to it before your object will accept it?