Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.11/require.min.js"></script>
</head>
</html>
 
// configuring paths for Require.js (you can use CommonJS (Component, Node.js) or simple script tags as well)
require.config({
  paths: {
    jdataview: '//jdataview.github.io/dist/jdataview',
    jbinary: '//jdataview.github.io/dist2/jbinary',
    TAR: '//jdataview.github.io/jBinary.Repo/typeSets/tar' // TAR archive typeset
  }
});
console.log('Loading scripts...');
require(['jbinary', 'TAR'], function (jBinary, TAR) {
  console.log('Loading data...');
  
  // loading TAR archive with given typeset
  jBinary.load('http://www.corsproxy.com/jdataview.github.io/jBinary.Repo/demo/tar/sample.tar', TAR).then(function (jb) {
    // got jBinary instance as Promise result
    console.log('Parsing...');
    // read everything using type aliased in TAR['jBinary.all']
    var files = jb.readAll();
    // do something with files in TAR archive (like log info and rename them to upper case)
    files.forEach(function (file) {
      console.log(file.name + ' (' + Math.round(file.size / 1024) + ' KB)');
      file.name = file.name.toUpperCase();
    });
    
    console.log('Saving...');
    jb.seek(0); // reusing same instance (and memory buffer) by resetting pointer
    jb.writeAll(files); // writing entire content from files array
    // calling browser "save as" dialog (or saving to disk if called from Node.js)
    jb.saveAs('sample.new.tar').then(function () {
      console.log('Done');
    });
  });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers