Documentation

Work with bytes types

A bytes type represents a sequence of byte values.

Type name: bytes

Bytes syntax

Flux does not provide a bytes literal syntax. Use the bytes() function to convert a string into bytes.

bytes(v: "hello")
// Returns [104 101 108 108 111]

Only string types can be converted to bytes.

Convert strings to bytes

Use bytes() or hex.bytes() to convert strings to bytes.

  • bytes(): Convert a string to bytes
  • hex.bytes(): Decode hexadecimal value and convert it to bytes.

Convert a hexadecimal string to bytes

import "contrib/bonitoo-io/hex"

hex.bytes(v: "FF5733")
// Returns [255 87 51] (bytes)

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.