My use case for binary data

I just wanted to tell why I would need support for binary data in Elm.

I need to HTTP GET a file from a server where don’t have the power over the data format sent.

The binary data are logged data from 4 different signals over a period in time. The file structure is a 32 bit float value for the first sample and signal, then first sample for the second signal, and so on. After that it repeats the 4 values for each point in time sampled.

In Elm I will present the information as line graphs.

I have now solved it with ports. The javascript code creates arrays of arrays containing Float32 and sends this to a (Array (Array Float)) port in Elm.

4 Likes

Not sure if you’ve seen this, but this recent project by the Elm team seems to deliver what you will need to achieve your goal just using Elm, no?

Yes, thank you, I saw that and the comment on the end, so I thought I would contribute in that way. I’m not really sure if it would be possible for me to test it and then make comments if it works for me or not? When cloning and adding it to elm.json I get the error: “The Bytes module has a bad import: import Elm.Kernel.Bytes”

If you have a concrete scenario in which you want to interpret bytes as densely packed arrays of integers or floats, please describe it on https://discourse.elm-lang.org/ in a friendly and high-level way. What is the project about? What do densely packed arrays do for that project? Is it about perf? What kind of algorithms are you using? Etc

That package isn’t published on the package manager yet, and since it contains kernel code, the compiler won’t let you use it until it’s published from the “elm” or “elm-community” organisations.
It’s in development and there’s a request for concrete use cases just like this one!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.