I have the following value in Elixir:
<<140, 143, 153, 192, 237, 255, 10>>
Binaries don't seem to be enumerable. I need to convert it to a list so I can iterate over it, byte-by-byte, something like:
[140, 143, 153, 192, 237, 255, 10]
. I understand that to_char_array would do it if all the bytes were valid unicode characters but they aren't.
Just getting started with Elixir and really appreciate any suggestions for converting binaries to lists(byte arrays).
Have a look at erlang's bin_to_list/1
:binary.bin_to_list(<<140, 143, 153, 192, 237, 255, 10>>)
# [140, 143, 153, 192, 237, 255, 10]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With