Base
Base conversion CLI and API, using either a JS or a C++ implementation.
Dependencies
- JS implementation
- C++ Implementation
- C++ compiler toolchain
- node-gyp
- Node.js modules
Install
- Clone source
npm install
- To use C++ implementations:
npm run build
Usage
CLI
$ base from to data implementation
from
and to
are bases to convert between, input
is the data to convert and implementation
is a known implementation (js, cpp). from
, to
and data
are required. implementation
is optional, defaults to cpp.
Example:
$ base 2 10 "0101001101010101" js
In a Node.js project
base = require('base')
API
base.api(from, to, input, implementation)
from
and to
are bases to convert between, input
is the data to convert and implementation
is a known implementation (js, cpp). from
, to
and data
are required. implementation
is optional, defaults to cpp.
Example:
base.api(10, 16, 255, 'js')
Raw
base[from][implementation][to](input)
from
and to
are bases to convert between, input
is the data to convert and implementation
is a known implementation (js, cpp).
Example:
base[10]['cpp'][16](255)
Tests and coverage information
npm run local_test