High-level I/O for binary data.
- Create jBinary instance from memory or from data source and your typeset.
Check out wiki for detailed API documentation.
Sure, how about TAR archive modification:
// configuring paths for Require.js// (you can use CommonJS (Component, Node.js) or simple script tags as well)requireconfigpaths:jdataview: '//jdataview.github.io/dist/jdataview'jbinary: '//jdataview.github.io/dist/jbinary'TAR: '//jdataview.github.io/jBinary.Repo/typeSets/tar' // TAR archive typeset;require'jbinary' 'TAR'// loading TAR archive with given typesetjBinaryload'' TARthen// read everything using type aliased in TAR['jBinary.all']var files = jbreadAll;// do something with files in TAR archive (like log info and rename them to upper case)filesforEachconsole.logfilename + ' (' + Mathroundfilesize / 1024 + ' KB)';filename = filenametoUpperCase;;jbseek0; // reusing same instance (and memory buffer) by resetting pointerjbwriteAllfiles; // writing entire content from files arrayjbsaveAs'sample.new.tar'; // saving file under given name;;
Advanced demo that shows abilities and performance of jBinary - Apple HTTP Live Streaming player which converts MPEG-TS video chunks from realtime stream to MP4 and plays them immediately one by one while converting few more chunks in background.
Also check out jBinary.Repo for advanced usage and demos of some popular file formats (and feel free to submit more!).
This library is provided under MIT license.