Hi,
Simon and I extended his Filereader library (
https://github.com/simonh1000/file-reader ) over the last few days to read binary files as well as text files. There are now 3 methods: readAsText, readAsArrayBuffer and readAsDataURL. One of the examples makes use of a Dropzone where you can drop images, then readAsDataURL is used to read an image as a dataURL (=base64 encoded) and assign that to an img src tag. The roundtripping of values from the event is done with a decoder that decodes the files as a Json.Values and uses that to pass it into one of the readAs* functions.
But as Simon wrote in this ticket
https://github.com/simonh1000/file-reader/issues/12 , the most interesting use case for readAsArrayBuffer would be to upload straight binary file - and this doesn't work right now because Elm.http lacks support for Blob/File (
https://github.com/evancz/elm-http/blob/3.0.0/src/Blob.elm is just a stub).
I don't know that much about Elm yet, so I want to ask more knowledgeable people here: what would it take to implement a Blob/File Api for Elm.http? Is it mostly about providing type definitions and handling the corresponding cases in Json.Decode/Json.Encode? If that is all I would see if I can come up with a solution and send a PR, but I'd like to know how deep the water might be before I get started with something like this :)
Also, Elm.http does not have a Contributing file, is there a general one for big important Elm libraries?
Daniel