Bytes
Bytes
Opaque byte sequences for the BEAM target (target = "erlang").
The JavaScript target keeps using the client platform Bytes package. This is not the browser file-picker API; see File for filesystem tasks.
Types
Bytes
type Bytes = BytesA sequence of bytes (OTP binary under the hood).
Examples
width (Bytes.Encode.encode (Bytes.Encode.string "hi")) == 2Endianness
type Endianness
= LE
| BEByte order for multi-byte integers and floats.
BE is network / "obvious" order; LE is Intel-style shuffled order.
Examples
Bytes.Encode.encode (Bytes.Encode.unsignedInt16 BE 7)
-- two bytes: 00 07
Bytes.Encode.encode (Bytes.Encode.unsignedInt16 LE 7)
-- two bytes: 07 00Values
width
width : Bytes -> IntNumber of bytes in the sequence.
Examples
width (Bytes.Encode.encode (Bytes.Encode.unsignedInt8 1)) == 1
width (Bytes.Encode.encode (Bytes.Encode.string "hi")) == 2getHostEndianness
getHostEndianness : Task x EndiannessHost machine endianness (usually LE on common CPUs).
Examples
-- Task that resolves to LE or BE
getHostEndianness