QuickArchive
This is a file archiving library designed to be as simple, fast and space efficient as possible. It's intended use is in transferring assets in web applications and runs on node.js an the browsers. It does not use compression.
Why?
Because if you have a web application with a large number of files that you need to load, it can be much quicker to load a single archive file than to load each file individually.
Additionally, many JavaScript implementations of existing archive formats (i.e. zip) either perform poorly, do not work as intended or don't work on both node.js and the broswer. QuickArchive prefers to create views of archived files instead of copies and therefore never uses much more memory than the size of the archive.
Compression is not included because most browsers and server support compression on the fly.
API
First, create a new archive.
var myArchive = ; //with optional commentsmyArchive;
Next, add some data to it.
//Data can be a string...myArchive; //Or a buffer on node, or a ArrayBuffer or ArrayBufferView on browsersmyArchive; //Also has optional commentsmyArchive;
Then call toBuffer()
and do whatever you want with it.
//Returns a Buffer on Node and a Uint8Array on browsersvar buffer = myArchive;
To load files, pass a Buffer or ArrayBuffer or ArrayBufferView to the constructor.
//Copy the archivevar anotherArchive = buffer;