2

Is there a way to read a file in elm?

I want to have an xml settings file where I will keep different settings and read it with elm (I've seen this parser, but it expects the xml content, not path). I don't want to use ports and these stuff. I need to apply some transformations to this xml because I will have more sets of values (staging and production) and I will need to generate an artefact for each value (I'm using TFS for this).

Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
  • 1
    Possible duplicate of [File Upload in Elm](http://stackoverflow.com/questions/35329962/file-upload-in-elm) – rofrol Dec 29 '16 at 19:46

2 Answers2

4

As of today (0.18.0), officially Elm does not support File API and other file-related APIs.

You can perform I/O only through WebSockets or over HTTP.

Anything else is covered by ports.

halfzebra
  • 6,771
  • 4
  • 32
  • 47
2

This library provides access to the filereader API. It is only on github because, as it uses native code, it cannot be published on elm-package.

However if you want to use it with xml you might be best using ports anyway, because then you could get javascripts xml parsing too, which will otherwise be a challenge in Elm too.

Simon H
  • 20,332
  • 14
  • 71
  • 128