btoa-lite

WebJar for btoa-lite

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

btoa-lite
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

btoa-lite
WebJar for btoa-lite
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/hughsk/btoa-lite

Download btoa-lite

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/btoa-lite/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>btoa-lite</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/btoa-lite/
implementation 'org.webjars.npm:btoa-lite:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/btoa-lite/
implementation ("org.webjars.npm:btoa-lite:1.0.0")
'org.webjars.npm:btoa-lite:jar:1.0.0'
<dependency org="org.webjars.npm" name="btoa-lite" rev="1.0.0">
  <artifact name="btoa-lite" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='btoa-lite', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "btoa-lite" % "1.0.0"
[org.webjars.npm/btoa-lite "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

btoa-lite

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

In the browser, encoding base64 strings is done using:

var encoded = btoa(decoded)

However in Node, it's done like so:

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

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

encoded = btoa(decoded)

Returns the base64-encoded value of a string.

License

MIT. See LICENSE.md for details.

Versions

Version
1.0.0