2.1.3 • Published 3 years ago

bitray v2.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Bitray

A Small Utility For Handling Binary Data

About

  • Integrates With Buffer
  • Small And Fast
  • Works In Browser And Node
  • Zero Dependencies

Installation

~ npm install bitray --save

Usage

Basic Usage

const Bitray = require('bitray')

const bit = new Bitray('Hello World 🌎')

console.log(bit.toFormat('hex'))

Buffer Integration

Convert Bitray to Buffer

const Bitray = require('bitray')

const bit = new Bitray('Hello World 🌎')

const buffer = Buffer.from(bit)
//===> <Buffer 68 65 6c 6c ... >

Convert Buffer to Bitray

const Bitray = require('bitray')

const buff = Buffer.from('Hello World 🌎')

const bit = Bitray.from(buff)
//===> <Buffer 68 65 6c 6c ... >

Encodings

Binray Supports The Following Encodings:

  • Utf-8
  • Base64
  • Hex
  • Binary/Latin1
  • Ucs2
  • Utf16

API

new Bitray(data: String | ArrayLike, format) -->> Uint8Array

Creates A New Bitray Instance. Built On Top Of Uint8Array.

.toFormat(encoding: string) -->> String

Convert Bitray Into A String Encoding.

Performance

Encode Performance Encode

Decode Performance Decode

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

1.0.0

3 years ago