Skip to content

Everything can be encoded into RCNB with JavaScript.

License

Notifications You must be signed in to change notification settings

rcnbapp/RCNB.js

Repository files navigation

RCNB.js Node.js CI

The world is based on RC. Thus, everything can be encoded into RCNB.

RCNB is available in various languages: JavaScript C PHP Pascal (more..)

Why RCNB?

RCNB vs Base64

Base64 RCNB
Speed ❌ Fast ✔️ Slow, motivate Intel to improve their CPU
Printable ❌ On all OS ✔️ Only on newer OS, motivate users to upgrade their legacy OS
Niubility ❌ Not at all ✔️ RCNB!
Example QmFzZTY0Lg== ȐĉņþƦȻƝƃŔć

Install

$ npm install --save rcnb # Add RCNB.js to your package
$ npm install -g rcnb # Install RCNB.js as a global CLI

Import

In Browser

<script type="module">
  import rcnb from "https://cdn.jsdelivr.net/npm/rcnb@2/rcnb.min.js"
</script>

Node.js

import rcnb from "rcnb"

Usage

In Code

rcnb.encode(new Uint8Array([114, 99, 110, 98])) // "ɌcńƁȓČņÞ"
rcnb.decode("ɌcńƁȓČņÞ") // Uint8Array [114, 99, 110, 98]

rcnb.encode(new TextEncoder("utf-8").encode("Who NB?")) // "ȐȼŃƅȓčƞÞƦȻƝƃŖć"
new TextDecoder("utf-8").decode(rcnb.decode("ȐĉņþƦȻƝƃŔć")) // "RCNB!"

With NodeJS Stream API

import fs from "fs"
import { EncodeStream, DecodeStream } from "rcnb"

fs.createReadStream("input.txt")
  .pipe(new EncodeStream())
  .pipe(fs.createWriteStream("rcnb.txt"))

fs.createReadStream("rcnb.txt")
  .pipe(new DecodeStream())
  .pipe(fs.createWriteStream("output.txt"))

EncodeStream([options]) / DecodeStream([options])

Support all available options of stream.Transform

Note that only streams of Buffer or string are supported.

CLI

$ rcnb encode "Who NB?"
#   ȐȼŃƅȓčƞÞƦȻƝƃŖć

$ rcnb decode "ȐĉņþƦȻƝƃŔć"
#   RCNB!

$ echo "The world is based on RC thus RCNB" >rcnb.txt
$ rcnb encode -- <rcnb.txt # With the option `--`, RCNB.js CLI reads from stdin.
#   ȐčnÞȒċƝÞɌČǹƄɌcŅƀȒĉȠƀȒȼȵƄŕƇŅbȒCŅßȒČnƅŕƇņƁȓċȵƀȐĉņþŕƇņÞȒȻŅBɌCňƀȐĉņþƦȻƝƃrƇ

About

Everything can be encoded into RCNB with JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published