pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/hyperdivision/bint8array

.githubassets.com/assets/primer-70be7debc79a8eff.css" /> GitHub - hyperdivision/bint8array: Uint8Array utils for parity with Buffers · GitHub
Skip to content

hyperdivision/bint8array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bint8array

Emulate core Buffer methods for Uint8Arrays

Usage

npm i -s bint8array
const bint = require('bint8array')

const buf = bint.allocUnsafe(32)
const hex = bint.fromString('776f726b7320696e2062726f7773657220746f6f21', 'hex')
const b64 = bint.fromString('deadbeef11247', 'hex')
const text = bint.toString(hex, 'utf8')

console.log(text)
// works in browser too!

console.log(bint.compare(Buffer.alloc(2), Buffer.alloc(2, 1)))
// -1

API

bint.toString(buf, [enc])

Decode bytes to a string according to the given encoding enc. Options for enc are ascii, utf8, utf-8, hex and base64.

bint.fromString(string, [enc])

Encode a string to binary according to the given encoding enc. Options for enc are ascii, utf8, utf-8, hex and base64.

Note that for hex encoding, if the string is not of even length, the last character shall be ignore. This is in keeping with the behaviour of the core Buffer.from method.

bint.compare(buf1, buf2)

Compare two Uint8Arrays bytewise. Returns -1 if buf1 is lesser, 1 if buf2 is greater and 0 if and only if buf1[i] ==== buf2[i] for all len = buf1.byteLength = buf2.byteLength.

bint.concat(arrrayOfBuffers)

Concatenate an array of Uint8Arrays into a single Uint8Array.

bint.allocUnsafe(size)

Create a new Uint8Array of a given size.

About

Uint8Array utils for parity with Buffers

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy