lz4-xhr.jsx

0.1.0 • Public • Published

lz4-xhr.jsx

Synopsis

lz4 filter for XHR

Motivation

It provides another XHR API with data decompression.

Code Example

 
var worker = new Worker('lz4-xhr.js');
worker.onmessage = function (event) {
    var content = event.content; // ArrayBuffer
    var dataView = new DataView(content);
    var decoder = new TextDecoder("utf-8");
    var json = JSON.parse(decoder.decode(dataView));
};
worker.postMessage('/content/data.json');

Installation

$ npm install lz4-xhr.jsx

JavaScript code is in dest/src folder.

API Reference

lz4-xhr provides simple API via WebWorker interface. It receives URL as a postMessage parameter. It returns content property of resulting event. content is an ArrayBuffer object.

Development

JSX

Don't be afraid JSX! If you have an experience of JavaScript, you can learn JSX quickly.

  • Static type system and unified class syntax.
  • All variables and methods belong to class.
  • JSX includes optimizer. You don't have to write tricky unreadalbe code for speed.
  • You can use almost all JavaScript API as you know. Some functions become static class functions. See reference.

Repository

Setup build environment

To create development environment, call following command:

$ npm install

Run Test

$ grunt test

Run Sample

# Build web worker and sample client 
$ grunt build
 
# Launch webserver 
$ grunt connect

Generate API reference

$ grunt doc

Author

License

MIT License.

Complete license is written in LICENSE.md.

Dependents (0)

Package Sidebar

Install

npm i lz4-xhr.jsx

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • shibu