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

baseit

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baseit

A node.js module for simple(r) handling of radix 2 through 36 base encodings.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Baseit

Base(x) In --> Base(x) Out

Install

npm install baseit

Basic Use

var baseit = require('baseit');

baseit({
	input: 	120000,
	to: 	36,
}, function (err, a) {
	if (err) throw err;

	console.log(a);		// "2klc"
});

Slightly Less Basic Use

var baseit = require('baseit');

baseit({
	input: 	1296,
	from: 	12,
	to: 	36,
	digits: 6
}, function (err, a) {
	if (err) throw err;

	console.log(a);		// "0001n6"
});

Parameters

####input (Required) Integer or string to be converted.

####to (Optional) Target encoding integer. If not specified, "to" will default to 10. Example for Base24: { to: 24 }.

####from (Optional) Input encoding integer. If not specified, "from" will default to 10. Example for Base8: { from: 8 }.

####digits (Optional) Minimum number of digits to return. Will append leading "zeros" to meet digit requirement. Example: { digits: 6 }

Why u no Base64!?

Node.js already has a good way of handling Base64 encoding.

Testing

vows test/*

FAQs

Package last updated on 03 Aug 2012

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