Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

base-64

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-64

A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6M
decreased by-2.66%
Maintainers
1
Weekly downloads
 
Created

What is base-64?

The base-64 npm package is a robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, built to work in a browser or Node.js environment. It allows users to encode and decode strings to and from base64, a binary-to-text encoding scheme that represents binary data in an ASCII string format.

What are base-64's main functionalities?

Encoding a string to base64

This feature allows you to encode a UTF-8 string into a base64 encoded string. The code sample demonstrates how to encode the string 'Hello, World!' to base64.

"use strict";\nvar base64 = require('base-64');\nvar utf8 = require('utf8');\n\nvar text = 'Hello, World!';\nvar bytes = utf8.encode(text);\nvar encoded = base64.encode(bytes);\nconsole.log(encoded); // Outputs: SGVsbG8sIFdvcmxkIQ==

Decoding a base64 string to UTF-8

This feature allows you to decode a base64 encoded string back into a UTF-8 string. The code sample demonstrates how to decode the base64 string 'SGVsbG8sIFdvcmxkIQ==' back to 'Hello, World!'.

"use strict";\nvar base64 = require('base-64');\nvar utf8 = require('utf8');\n\nvar encoded = 'SGVsbG8sIFdvcmxkIQ==';\nvar bytes = base64.decode(encoded);\nvar text = utf8.decode(bytes);\nconsole.log(text); // Outputs: Hello, World!

Other packages similar to base-64

Keywords

FAQs

Package last updated on 17 Oct 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc