Binary data [language.binary]
Use byte to denote binary data. Use seq[byte] for dynamic byte arrays.
Avoid string for binary data. If stdlib returns strings, convert to seq[byte] as early as possible
Pros
- Explicit type for binary data helps convey intent
Cons
charanduint8are common choices often seen inNim- hidden assumption that 1 byte == 8 bits
- language still being developed to handle this properly - many legacy functions return
stringfor binary data
Practical notes
- stew contains helpers for dealing with bytes and strings