binary
binary subcommand ?arg ...?
Packs values into bytes and reads values from bytes, with a template of letters such as c (8 bits), s (16 bits, little endian), S (big endian), i and I (32 bits), w and W (64 bits), f and d (floats), a (bytes), and H (hexadecimal). A count or * follows a letter.
Subcommands
| Synopsis | What it does |
|---|---|
binary format TEMPLATE ?VALUE ...? |
Gives the bytes. |
binary scan BYTES TEMPLATE ?VAR ...? |
Sets the variables and gives the count of values that it read. |
binary encode FORMAT ?-option value ...? DATA |
base64, hex, or uuencode text of the bytes. |
binary decode FORMAT ?-option value ...? DATA |
The bytes of the text. |
Examples
A click on an example runs it in the shell of the page.
binary encode hex [binary format S 258]:0102binary scan [binary format c3 {1 2 3}] c* l:1binary encode base64 hello:aGVsbG8=
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.