Skip to main content

Binary

Library of functions for the binary type.

Functions

Base64

Encodes a binary value onto a base64 string.

Syntax:
Binary.Base64(value: binary)
Parameters
  • value: The binary to convert to a base64 string.
Returns
  • string: The base64 representation of the binary.
Example:
Binary.Base64(Binary.FromString("Hello World!"))

FromString

Converts a string into a binary.

Syntax:
Binary.FromString(value: string)
Parameters
  • value: The string to convert to binary.
Returns
  • binary: The binary representation of the string.
Example:
Binary.FromString("Hello World!")
// Result:
// 0x48656c6c6f20576f726c6421
note

The string is encoded as UTF-8.

Read

Reads the contents of a location as a binary.

Syntax:
Binary.Read(value: location)
Parameters
  • value: The location to read bytes from.
Returns
  • binary: The binary read from the location, or error if the location could not be read.
Example:
Binary.Read("http://example.org/test.binary")
note

The location must be accessible as a bytestream.