Converts binary data to a string.

binaryEncode(binarydata, encoding) → returns string

binaryEncode Argument Reference

binarydata binary

A string containing encoded binary data.

encoding string

A string specifying the encoding method to use to represent
the data; one of the following:
- hex: use characters 0-9 and A-F represent the hexadecimal value
of each byte; for example, 3A.
- UU: use the UNIX UUencode algorithm to convert the data.
- base64: use the Base64 algorithm to convert the data.
  • hex
  • uu
  • base64

Examples sample code invoking the binaryEncode function

Encode a binary string back to a string using hex

use binaryEncode to Encode with hex

s = binaryDecode('s = binaryDecode('737472696E67','hex');

Expected Result: 737472696E67

Encode a binary using UNIX UUencode (UU) back into string

use binaryEncode to Encode with UNIX UUencode (UU)

s = binaryDecode('&<W1R:6YG','UU');

Expected Result: string

Encode a binary using base64 back into a string

use binaryEncode to Encode with base64

s = binaryDecode('s = binaryDecode('&<W1R:6YG','base64');

Expected Result: string

Fork me on GitHub