-
Notifications
You must be signed in to change notification settings - Fork 55
The Repo
Ingvar Stepanyan edited this page Sep 10, 2013
·
4 revisions
jBinary provides special Repo for popular file formats and corresponding demos.
Using standard typesets is easy - just make require-like call to jBinary.Repo
async loader method.
You can call it with one typeset name:
jBinary.Repo('bmp', function (BMP) {
var binary = new jBinary(data, BMP);
// ...do whatever you want with `binary` or simply...
var data = binary.readAll();
// ...get entire file as parsed object in `data`
});
Or with list of names:
jBinary.Repo(['tar', 'gzip'], function (TAR, GZIP) {
// your code goes here ;)
});
Or using AMD require
method:
require(['jbinary.repo!tar', 'jbinary.repo!gzip'], function (TAR, GZIP) {
// you can put just the same code as in sample above
});
All the typesets that are already loaded, are stored inside jBinary.Repo
itself with upper-case names of typesets used as keys (like jBinary.Repo.BMP
).
If you know some popular format structure and can write own typeset, you're welcome to contribute!