Package Exports
- bitray
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 (bitray) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
Decode Performance