radialcode
v0.1.1
Published
High-performance JavaScript & Node.js bindings for Radial Response Code (RRC)
Maintainers
Readme
radialcode (Radial Response Code)
High-performance JavaScript, TypeScript & Node.js bindings for Radial Response Code (RRC) — an original polar 2D optical code format with 360-degree rotation invariance, concentric annular data rings, and Reed-Solomon error correction over $\text{GF}(2^8)$.
Powered by Rust and N-API (napi-rs).
Installation
npm install radialcodeQuick Start (TypeScript / ESM)
import { encodeSvg, encodePng, decode, decodeImage, decodeRgba, getVersionInfo } from 'radialcode';
import * as fs from 'fs';
// Query version capacity specs
const v1 = getVersionInfo(1);
console.log(`V1 rings: ${v1.ringCount}, data bytes: ${v1.capacityBytesM}`);
// 1. Generate Vector SVG
const svg = encodeSvg('https://github.com/MdSagorMunshi/rrc', {
ecc: 'H',
style: 'rounded',
darkColor: '#00FF94',
lightColor: '#0A0A0A',
});
fs.writeFileSync('badge.svg', svg);
// 2. Generate Raster PNG Buffer
const png = encodePng('https://github.com/MdSagorMunshi/rrc', {
ecc: 'M',
renderScale: 12,
});
fs.writeFileSync('badge.png', png);
// 3. Decode directly from an image file (PNG / JPEG / WebP)
const imageBuffer = fs.readFileSync('badge.png');
const result = decodeImage(imageBuffer); // or decode(imageBuffer)
console.log('Decoded text:', result.text);
// 4. Decode from raw RGBA buffer (HTML5 Canvas / Camera frame)
// const result = decodeRgba(canvasImageData.data, width, height);Documentation & Specification
- GitHub Repository: https://github.com/MdSagorMunshi/rrc
- Specification: RFC 2026-RRC (SPEC.md)
- Full Integration Guide: INTEGRATION.md
License
Apache-2.0. Author: Ryan Shelby (MdSagorMunshi).
