atob-lite
Smallest/simplest possible means of using atob with both Node and browserify
Last updated 8 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install atob-lite 
SYNC missed versions from official npm registry.

atob-lite

Smallest/simplest possible means of using atob with both Node and browserify.

In the browser, decoding base64 strings is done using:

var decoded = atob(encoded)

However in Node, it's done like so:

var decoded = new Buffer(encoded, 'base64').toString('utf8')

You can easily check if Buffer exists and switch between the approaches accordingly, but using Buffer anywhere in your browser source will pull in browserify's Buffer shim which is pretty hefty. This package uses the main and browser fields in its package.json to perform this check at build time and avoid pulling Buffer in unnecessarily.

Usage

NPM

decoded = atob(encoded)

Returns the decoded value of a base64-encoded string.

License

MIT. See LICENSE.md for details.

Current Tags

  • 2.0.0                                ...           latest (8 years ago)

2 Versions

  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)

© 2010 - cnpmjs.org x YWFE | Home | YWFE