Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 9, 2024 via pnpm

base64-js 1.5.1

Base64 encoding/decoding in pure JS
Package summary
Share
0
issues
1
license
1
MIT
Package created
26 Nov 2011
Version published
11 Nov 2020
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
base64-js@1.5.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of base64-js 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does base64-js do?

Base64-js is a pure JavaScript module that provides basic base64 encoding and decoding functionality. While many browsers already support base64 encoding/decoding for text data, base64-js brings this functionality to all-purpose binary data, thus significantly expanding the use cases for base64 operations.

How do you use base64-js?

The base64-js module is simple to install and use. You can install it with npm using the command npm install base64-js. After its installation, it can be included in your JavaScript files using var base64js = require('base64-js').

Working with base64-js is quite simple as it exposes three primary functions byteLength, toByteArray and fromByteArray.

var base64js = require('base64-js');

// Assuming you have a base64 string, you can get the byte length as follows:
var base64String = 'your-base64string';
var byteLength = base64js.byteLength(base64String);
console.log(byteLength); // Outputs byte length of the string

// To get the byte array from a base64 string
var byteArray = base64js.toByteArray(base64String);
console.log(byteArray); // Outputs the byte array

// To convert a byte array to a base64 string
var byteArr = new Uint8Array([1, 2, 3]);
var base64Str = base64js.fromByteArray(byteArr);
console.log(base64Str); // Outputs the base64 string

The byteLength function takes a base64 string and returns the length of the byte array. The toByteArray function takes a base64 string and returns a byte array. Conversely, the fromByteArray function takes a byte array and returns a base64 string.

Where are the base64-js docs?

As for the base64-js documentation, while it doesn't appear to have its own standalone website, the most comprehensive and updated descriptions, examples and usage guidelines can be found directly on its GitHub page at beatgammit/base64-js.