Socket
Socket
Sign inDemoInstall

btoa

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    btoa

btoa for Node.JS (it's a one-liner)


Version published
Weekly downloads
2.1M
decreased by-17.08%
Maintainers
1
Install size
32.1 kB
Created
Weekly downloads
 

Package description

What is btoa?

The btoa npm package is a utility for encoding data to base64, particularly designed to mimic the btoa function available in web browsers. It is primarily used to convert binary data to a base64 encoded string, which is useful for transmitting data over media that are designed to deal with textual data.

What are btoa's main functionalities?

Base64 Encoding

This feature allows you to encode a string into a base64 format. The provided code sample demonstrates encoding the string 'Hello, World!' into its base64 representation.

const btoa = require('btoa');
const encodedData = btoa('Hello, World!');
console.log(encodedData);

Other packages similar to btoa

Readme

Source

btoa

| atob | btoa | unibabel.js | Sponsored by ppl

A port of the browser's btoa function.

Uses Buffer to emulate the exact functionality of the browser's btoa (except that it supports some unicode that the browser may not).

It turns binary data to base64-encoded ascii.

(function () {
  "use strict";

  var btoa = require('btoa');
  var bin = "Hello, 世界";
  var b64 = btoa(bin);

  console.log(b64); // "SGVsbG8sIBZM"
}());

Note: Unicode may or may not be handled incorrectly. This module is intended to provide exact compatibility with the browser.

Code copyright 2012-2018 AJ ONeal

Dual-licensed MIT and Apache-2.0

Docs copyright 2012-2018 AJ ONeal

Docs released under Creative Commons.

Keywords

FAQs

Last updated on 28 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc