Skip to content

jasuca/Base64.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base64.js

≈ 500 byte* polyfill for browsers which don't provide window.btoa and window.atob.

Although the script does no harm in browsers which do provide these functions, a conditional script loader such as yepnope can prevent unnecessary HTTP requests.

yepnope({
  test: window.btoa && window.atob,
  nope: 'base64.js',
  callback: function () {
    // `btoa` and `atob` are now safe to use
  }
})

To add via requirejs use something like:

require(["base64"], function(base64) {
    window.atob = base64.atob
    window.btoa = base64.btoa
});

Base64.js stems from a gist by yahiko.

Running the test suite

make setup
make test

* Minified and gzipped. Run make bytes to verify.

About

Polyfill for browsers which don't provide window.btoa and window.atob

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 52.1%
  • JavaScript 47.9%