elm/bytes

Add `Bytes.decoder : Json.Decode.Decoder Bytes`

utkarshkukreti opened this issue · 3 comments

A Bytes type is just a DataView so the implementation should be pretty straightforward, just like File.decoder.

Do you think this approach is correct? Would you like me to open a PR with this change?

Use case: I have data in a Uint8Array in JS and I want to use it with an elm-protocol-buffers-like package but I can't send it over a port because there's no way to decode into Bytes.

I also would like to be able to send Bytes over a port (without having to go via base64 or some other hack).

mzero commented

My use case is send/receiving MIDI data via WebMIDI.

It might also be great to have a Bytes.encode function too