-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (25 loc) · 771 Bytes
/
server.js
File metadata and controls
31 lines (25 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Require the module
var EasyFit = require('./node_modules/easy-fit/dist/easy-fit.js').default;
// Read a .FIT file
var fs = require('fs');
fs.readFile('1361680148.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));
var output = fs.writeFile('1361680148.json', JSON.stringify(data)); // need to add callback fct.
}
});
});