atob
Decode a string of data which has been encoded using Base64 encoding.
Usage
var atob = require( '@stdlib/string/base/atob' );
atob( str )
Decodes a string of data which has been encoded using Base64 encoding.
var out = atob( 'SGVsbG8sIHdvcmxk' );
// returns 'Hello, world'
Notes
- This function differs from the global
atob
available in web browsers and more recent Node.js versions in that the function returnsnull
when provided a string containing non-ASCII characters, rather than raising an exception.
Examples
var atob = require( '@stdlib/string/base/atob' );
var str = 'SGVsbG8gV29ybGQh';
var out = atob( str );
// returns 'Hello World!'
str = 'SEVMTE8gV09STEQh';
out = atob( str );
// returns 'HELLO WORLD!'
str = 'VG8gYmUsIG9yIG5vdCB0byBiZTogdGhhdCBpcyB0aGUgcXVlc3Rpb24u';
out = atob( str );
// returns 'To be, or not to be: that is the question.'