1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00
No description
Find a file
2017-03-02 07:51:06 -08:00
archive Add support for standard filter VMSF_RGB 2017-03-02 07:51:06 -08:00
docs Update link in unrar doc to bitjs on github. 2017-02-21 18:24:17 -08:00
io Whitespace and a couple arrow functions 2017-02-21 12:05:03 -08:00
tests Fix untarring by ensuring it gets a fresh buffer of data and add a test 2017-02-20 23:40:33 -08:00
LICENSE Accidentally didn't add the updated files. 2016-04-19 18:00:27 -07:00
README.md Update README.md 2017-02-21 16:36:05 -08:00

bitjs: Binary Tools for JavaScript

Introduction

A set of tools to handle binary data in JS (using Typed Arrays).

Example Usage

bitjs.io

This namespace includes stream objects for reading and writing binary data at the bit and byte level: BitStream, ByteStream.

var bstream = new bitjs.io.BitStream(someArrayBuffer, true, offset, length);
var crc = bstream.readBits(12); // read in 12 bits as CRC, advancing the pointer
var flagbits = bstream.peekBits(6); // look ahead at next 6 bits, but do not advance the pointer

bitjs.archive

This namespace includes objects for unarchiving binary data in popular archive formats (zip, rar, tar) providing unzip, unrar and untar capabilities via JavaScript in the browser. The unarchive code depends on browser support of Web Workers. See the design doc.

function updateProgressBar(e) { ... update UI element ... }
function displayZipContents(e) { ... display contents of the extracted zip file ... }

var unzipper = new bitjs.archive.Unzipper(zipFileArrayBuffer); unzipper.addEventListener("progress", updateProgressBar); unzipper.addEventListener("finish", displayZipContents); unzipper.start();

Tests

Reference

  • UnRar: An work-in-progress description of the RAR file format.

History

This repository was automatically exported from [my original repository on GoogleCode] (https://code.google.com/p/bitjs) and then I cherry-picked some commits from antimatter15's fork. I've also fixed a bunch of bugs, added starter RarVM support, added tests and updated to ES6.