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

@multiformats/base-x

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@multiformats/base-x

Fast base encoding / decoding of any given alphabet

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
122K
decreased by-3.74%
Maintainers
4
Weekly downloads
 
Created

What is @multiformats/base-x?

@multiformats/base-x is a JavaScript library for encoding and decoding data using custom base alphabets. It is commonly used for encoding binary data into a textual representation that is more human-readable and easier to handle in text-based systems.

What are @multiformats/base-x's main functionalities?

Custom Base Encoding

This feature allows you to encode data using a custom base alphabet. In this example, the data 'hello world' is encoded using the Base58 alphabet.

const baseX = require('@multiformats/base-x');
const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
const base58 = baseX(BASE58);
const encoded = base58.encode(Buffer.from('hello world'));
console.log(encoded); // prints 'StV1DL6CwTryKyV'

Custom Base Decoding

This feature allows you to decode data that was encoded using a custom base alphabet. In this example, the encoded string 'StV1DL6CwTryKyV' is decoded back to 'hello world'.

const baseX = require('@multiformats/base-x');
const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
const base58 = baseX(BASE58);
const decoded = base58.decode('StV1DL6CwTryKyV');
console.log(decoded.toString()); // prints 'hello world'

Other packages similar to @multiformats/base-x

Keywords

FAQs

Package last updated on 16 Sep 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