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.
Prev | Home | Next |
Window.alert() | Up | Window.attachEvent() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |