Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

  1. # btoa-lite
  2. ![](http://img.shields.io/badge/stability-stable-orange.svg?style=flat)
  3. ![](http://img.shields.io/npm/v/btoa-lite.svg?style=flat)
  4. ![](http://img.shields.io/npm/dm/btoa-lite.svg?style=flat)
  5. ![](http://img.shields.io/npm/l/btoa-lite.svg?style=flat)
  6. Smallest/simplest possible means of using btoa with both Node and browserify.
  7. In the browser, encoding base64 strings is done using:
  8. ``` javascript
  9. var encoded = btoa(decoded)
  10. ```
  11. However in Node, it's done like so:
  12. ``` javascript
  13. var encoded = new Buffer(decoded).toString('base64')
  14. ```
  15. You can easily check if `Buffer` exists and switch between the approaches
  16. accordingly, but using `Buffer` anywhere in your browser source will pull
  17. in browserify's `Buffer` shim which is pretty hefty. This package uses
  18. the `main` and `browser` fields in its `package.json` to perform this
  19. check at build time and avoid pulling `Buffer` in unnecessarily.
  20. ## Usage
  21. [![NPM](https://nodei.co/npm/btoa-lite.png)](https://nodei.co/npm/btoa-lite/)
  22. ### `encoded = btoa(decoded)`
  23. Returns the base64-encoded value of a string.
  24. ## License
  25. MIT. See [LICENSE.md](http://github.com/hughsk/btoa-lite/blob/master/LICENSE.md) for details.