Simple interface for reading blobs sequentially
JavaScript
Switch branches/tags
Clone or download
Latest commit 5b6037d Dec 17, 2015
Permalink
Failed to load latest commit information.
dist Prepare for npm Dec 17, 2015
docs Update docs Jan 23, 2015
src Prepare for npm Dec 17, 2015
test Add test for data uri Jan 27, 2015
.jscsrc Add jscs & jshint Jan 27, 2015
.jshintrc Add jscs & jshint Jan 27, 2015
.npmignore Add npm ignore Dec 17, 2015
.travis.yml Update travis script Jan 22, 2015
LICENSE Initial commit Jan 22, 2015
README.md Update roadmap Dec 17, 2015
bower.json Add bower.json Jan 22, 2015
gulpfile.js Prepare for npm Dec 17, 2015
karma.conf.js Prepare for npm Dec 17, 2015
package.json Prepare for npm Dec 17, 2015

README.md

BlobReader

Simple interface for reading blobs, sequentially. 3202 bytes minified and 1172 bytes minified + gzipped.

Example

// Blob definition
var uint8 = new Uint8Array([1, 2]);
var uint16 = new Uint16Array([3]);
var uint82 = new Uint8Array([4, 3]);
var uint32 = new Uint32Array([8]);
var blob = new Blob([uint8, uint16, uint82, uint32]);

// Reading the blob
BlobReader(blob)
.readUint8('uint8', 2)
.readUint16('uint16')
.readUint8('uint82', 2)
.skip()
.readUint32('uint32')
.commit(function (data) {
  expect(data.uint8[0]).toBe(1);
  expect(data.uint8[1]).toBe(2);
  expect(data.uint16).toBe(3);
  expect(typeof data.uint82).toBe('number');
  expect(data.uint82).toBe(4);
  expect(data.uint32).toBe(8);
});

Roadmap

  • Add support for synchronous blob reading in workers.
  • Add support for observables/promises.

License

MIT