Window.atob() (Function)

Decode some base-64 encoded data.


JavaScript - 1.2
Netscape - 4.0
Property/method value type:String primitive
JavaScript syntax:Natob(aBase64String)
Argument list:aBase64StringA string containing base-64 encoded data

This function provides a means of decoding base-64 encoded values which represent an encoded form of some binary data. This encoding can be applied to text too, but is most useful where you have a block of non-textual content.

The base-64 data is decoded and converted to a block of binary data. This is then stored in a string primitive and returned to the caller as the result of the method.

To extract the binary data from the string, you will need to parse the string a character at a time and extract the numeric character value with the String.charCodeAt() method. You can modify the binary data directly by storing numeric values at each character position.

Note that the string will contain a sequence of 8-bit bytes and so you will need to be careful to range-limit any values that you store in the binary string.

The result is a block of binary data in a string primitive. This is somewhat cumbersome and not likely to be much used outside of a mail-reading client.

See also:String.charAt(), String.charCodeAt(), String.fromCharCode(), Window.btoa()