This is a library for loading assets files in batches. It works well for HTML5
games and for large web apps.

Normally, the browser downloads your assets one at a time using one request for
each, usually 4 - 8 requests at a time. This can be slow because of the added
latency between the browser and the server. To work around this, you would
merge your code files with browserify and maybe merge image
files too or embed them into css. All of these approaches seriously hurt workflow & debugging.
AxLoader solves this problem by allowing you use a normal workflow without the
scalability problems. It does this by putting all your assets in an archive file
and downloading them all in one request.

This approach has several advantages:

Allows incremental updates

Less round trips

Easy zero downtime updates

You control the cache

You don't have to maintain a list of assets for the client to download

AxLoader reads in your files and builds an archive and an index. The client
will work out the most up to date version is, download
it, and extract your assets in memory so you can use them as you wish.

It also has utility methods for turning data into strings or data urls, parsed
JSON, and it will run your script files if you want, in a way that plays nicely
with the debugger.

The best part: When it generates the archive, it also reads old versions
of your app and generates patch files against them. If the client has an old version
cached and a patch is available, it'll apply the patch file to the cached version
automatically.

The browser still has to send one request for each file. Even with small latencies and,
this can take some time, especially if nothing has changed. With AxLoader, it takes
one round trip to know if you're up to date and one more to do the update.

Additionally, if you publish a new version of your app while a client is downloading it, the client might
get files from both versions. Not only does AxLoader not do this, but you can manually
tell your app to check for updates.

This library includes a development server that automatically generates archive files
every time one is requested. You can start it by running
require("axloader").devserver({/*config*/}).
The config object looks like this:

{

//Set this to the directory your assets are in. You can list multiple locations

//to generate multiple archives. The last part of each path should be unique.

Whatever server platform you choose to run in production, all you have to do is statically
serve the files output by AxLoader. By default, it looks for the files using relative paths.
You can change this using syntax like this:

Simply run require("axloader").generate({/*config*/}) where the config is the same as
specified above. This will generate a new production version of the project, as well
as incremental patches for all recent versions, and place them in the output
folder.

Once these new files are put on the production server, the client will
know which files to download through the index file. It will
download patch files if it has an old version and an appropriate patch exists.

AxLoader requests the index file on load, which is how it knows which version to download.
This means that if you publish a new version after the client loads the index, it won't
be able to see it. You can force reload using the checkForUpdates function.

The checkForUpdates function takes a callback argument, which will be passed a boolean,
whether there are any updates.

Be very careful with this as it updates the index for everything. If you have multiple
archives you can end up with mismatches. It's up to you to unload an old version before
getting a new one.

It is safe to start loading a new file while AxLoader is still checking for updates. You'll
get the up to date version.

The third parameter of startLoading is an array of functions that process the data.
Since the data comes in the form of Uint8Arrays, you'll probably need to process it. A collection
of these functions are included.

The postprocessing functions are called for each item in the archive, so you need to filter them
so only the ones you want get processed. Do this with the filter functions:

AxLoader.FILTER.WITH_EXT(ext, func) Only call func for files with a matching extention.

AxLoader.FILTER.WITH_FILE(name, func) Only call func for files with a matching filename.