JSPM

basenone

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q5597F
  • License ISC

Encode Uint8Array to strings and back.

Package Exports

  • basenone
  • basenone/dist/lib.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (basenone) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

BaseNone is a simple dependency free library to encode Uint8Array to strings and back.

BaseNone should work in any modern browser, compliant javascript runtimes and Node.js.

Installation

npm install basenone

Constructor

import BaseNone from 'basenone'

const baseNone = new BaseNone(Uint8Array)

Ascii

// static method
const baseNone = BaseNone.fromAscii('My ascii string');

// raw Uint8Array
const raw = baseNone.getRaw();

// BaseNone to ascii
const ascii: string = baseNone.toAscii();

Binary

// static method
const baseNone = BaseNone.fromBinary('0100100001100101011011000110110001101111');

// raw Uint8Array
const raw = baseNone.getRaw();

// BaseNone to binary
const binary: string = baseNone.toBinary();

Base 16 (Hex)

// static method
const baseNone = BaseNone.fromHex('48656c6c6f2c20576f726c6421');

// raw Uint8Array
const raw = baseNone.getRaw();

// BaseNone to hex
const hex: string = baseNone.toHex();

base64

// static method
const baseNone = BaseNone.fromBase64('SGVsbG8sIFdvcmxkIQ==');

// raw Uint8Array
const raw = baseNone.getRaw();

// BaseNone to base64
const base64: string = baseNone.toBase64();

UTF-8

// static method
const baseNone = BaseNone.fromUTF8('你好世界');

// raw Uint8Array
const raw = baseNone.getRaw();

// BaseNone to utf8
const utf8: string = baseNone.toUTF8();

In Progress

  • Base 32
  • Base 62