Comments (10)
Hi!
I think that it is technically possible. Though I tried to make it work with the FileReader api, but I failed, and I didn't have much time to investigate.
It would be an awesome feature.
from easy-fit.
Thanks, I will also have a look at it.
Nice job!
from easy-fit.
I made it
brvier/ForRunners@b323bf7
But readAsArrayBuffer return an array buffer so i changed getArrayBuffer(buffer) in binary.js to return buffer ... ;p
But some changes was required .... first using browserify :
$ browserify easy-fit.js --standalone easy-fit > easy-fit.bundle.js
from easy-fit.
Looking good!
from easy-fit.
Here is a working example of the simplified version of @khertan
`
<title>Easy FIT</title>
</head>
<body>
<input type="file" id="fileUpload">
<script type="text/javascript" src="easy-fit.bundle.js"></script>
<script>
var fileUpload = document.getElementById("fileUpload");
fileUpload.addEventListener("change", function(event) {
var file = this.files[0];
var EasyFit = window.easyFit.default;
var reader = new FileReader();
reader.onloadend = function() {
// Create a EasyFit instance (options argument is optional)
var easyFit = new EasyFit({
force: true,
speedUnit: 'km/h',
lengthUnit: 'km',
temperatureUnit: 'celcius',
elapsedRecordField: true,
mode: 'cascade',
});
easyFit.parse(this.result, function (error, data) {
if (error) {
console.log(error);
} else {
console.log(data);
}
});
};
reader.readAsArrayBuffer(file);
}, false);
})();
</script>
</body>
from easy-fit.
@khertan @corand Awesome! Thanks for your investigation :)
from easy-fit.
Hi, late to the show I guess,
I had a look at this, but browserify doesn't work with ES6 module import and export. I understand that I could transpile it to ES5 with babel (though I don't know how to do that). Just wondering if there was any other solution?
I suppose I could manually copy and paste the modules into the main js file, but that seems a bit counter-productive. (Though I'll probably have a go for now.)
Gordon
from easy-fit.
Hi @gfmoore, thanks for the interest!
Iβll try my best to answer this but itβs been a while (we will have a TypeScript version coming up some day with @jimmykane). What stack are you using on the front end?
from easy-fit.
Hey, thanks for the response. Don't worry about it as now I've simply grabbed all four js files, removed imports, exports, wrote a function to replace the Buffer usage (only the one that makes a string from the array of int (bytes) and it works client side. Not perhaps elegant, not perhaps very modular, but it's a hack and allows me to do what I want. I posted the code in a comment on the backfit site backfit/backfit#6
It's a hack! (I'm just using JS, jQuery, jStat and D3 for developing some personal apps (cycling, Karoo v1) and just wanted to grab my data quickly. For some strange reason the Karoo dashboard does not do anything with the data it grabs, but does allow download of data in a FIT file. I'm not paying Strava for the analysis...
Ta.
from easy-fit.
@gfmoore Cool! Glad this way works for you. Never had to transpile stuff outside of pipelines like Grunt which make it easy.
from easy-fit.
Related Issues (20)
- release a version with the latest fit.js? HOT 3
- "Incorrect header size" when passing blob from Filereader HOT 1
- Strange record data when importing a fit file from movescount HOT 3
- Incorrrect offset for altitude fields HOT 1
- Incorrect constant used in FIT time to unix epoch time conversion HOT 3
- Incorrect location records and activity after parsing HOT 5
- Please bump the version the include the latest changes HOT 3
- There is something wrong with NPM package version HOT 4
- Fails to parse FIT file with developer fields
- cannot set option `force`
- Power Data messed up when no powermeter available HOT 5
- Records incomplete when trying to parse a fit file from a Wahoo GPS HOT 2
- Add timer time to records HOT 5
- avg_stance_time_percent seems to have incorrect value HOT 15
- left_right_balance not being parsed correct
- Incorrect sport mapping: hang gliding instead of paragliding
- How can i use it without node HOT 1
- Any chance to export to fit again? HOT 1
- Use in browser (client side)
- gps coordinates HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easy-fit.