Install

npm i @mini-ware/encode-decode

Encode

const encode = require("@mini-ware/encode-decode").encode();

//binary
console.log(encode("bin", "sample"));

//base64
console.log(encode("b64", "sample"));

//hexadecimal
console.log(encode("hex", "sample"));

Decode

const decode = require("@mini-ware/encode-decode").decode();

//binary
console.log(decode("bin", "011100110110000101101101011100000110110001100101"));

//base64
console.log(decode("b64", "c2FtcGxl"));

//hexadecimal
console.log(decode("hex", "73616D706C65"));

GitHub

View Github