Functions

btoa

Supported By

Syntax

[the] btoa of data

[the] btoa of ( data , algorithm )

btoa ( data [, algorithm] )

Data yields a binary. Algorithm yields the name of a binary-to-ASCII encoding algorithm.

Description

The btoa function encodes binary data into ASCII text using the specified algorithm. If the algorithm is not specified, base64 is the default.

The btoa function supports the following algorithms:

b64, base64 The Base64 encoding scheme. Does not produce any headers, footers, or line breaks; they must be added manually.
uu, uue, uuencode The uuencode/uudecode encoding scheme. Produces line breaks every 45 bytes. Does not produce any headers or footers; they must be added manually.
xx, xxe, xxencode The xxencode/xxdecode encoding scheme. Produces line breaks every 45 bytes. Does not produce any headers or footers; they must be added manually.
hqx, binhex The encoding scheme used by BinHex, including run-length encoding. Produces the beginning and ending colons. Does not produce any headers; they must be added manually. Assumes binary data is already structured appropriately (metadata, resource fork, and CRCs must be added manually).
a85, ascii85 The ASCII85 encoding scheme. Produces the <~ and ~> markers. Does not produce the y character for a string of four spaces.
k85, kreative85 A variant of the ASCII85 encoding scheme that uses a different alphabet. Does not produce any markers.
l85, legacy85 Something Resplendence calls Base85. Don't use this.

See Also

atob