elm: read file content

ぃ、小莉子 提交于 2019-12-12 19:46:46

问题


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).


回答1:


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.




回答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.



来源:https://stackoverflow.com/questions/41344662/elm-read-file-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!