define(['Format'], function(Format) {

  'use strict';
  
  const SECTOR_BYTES = 512;
  const HEADER_FORMAT = Format('magic-shadow-archiver/header');
  const TRACK_FORMAT = Format('magic-shadow-archiver/track');
  const COMPRESSED_TRACK_FORMAT = Format('magic-shadow-archiver/compressed-track');
  
  return {
    split: function(segment, entries) {
      return segment.getSegment(HEADER_FORMAT, 0, 10).getStruct()
      .then(function(header) {
        if (!header.hasValidSignature) {
          return Promise.reject('invalid MSA');
        }
        const TRACK_BYTES = SECTOR_BYTES * header.sectorsPerTrack;
        var offset = 10;
        function doTrack(n) {
          if (n > header.lastTrack) return;
          return segment.getUint16(offset, false)
          .then(function(trackLength) {
            if (trackLength === TRACK_BYTES) {
              // uncompressed
              entries.add(segment.getSegment(TRACK_FORMAT, offset + 2, trackLength));
            }
            else {
              entries.add(segment.getSegment(COMPRESSED_TRACK_FORMAT, offset + 2, trackLength));
            }
            offset += 2 + trackLength;
            doTrack(n + 1);
          });
        }
        return doTrack(header.firstTrack);
      });
    },
  };

});

@@ -147,154 +147,8 @@
 ');%0A
-  const TRACK_FORMAT = Format('magic-shadow-archiver/track');%0A  const COMPRESSED_TRACK_FORMAT = Format('magic-shadow-archiver/compressed-track');%0A
   %0A 
@@ -645,24 +645,53 @@
 ckLength) %7B%0A
+            var trackFormat;%0A
             
@@ -743,107 +743,209 @@
     
-// uncompressed%0A              entries.add(segment.getSegment(TRACK_FORMAT, offset + 2, trackLength)
+trackFormat = Format('magic-shadow-archiver/track', %7Bwhich:n%7D);%0A            %7D%0A            else %7B%0A              trackFormat = Format('magic-shadow-archiver/compressed-track', %7Bwhich:n, full:TRACK_BYTES%7D
 );%0A 
@@ -957,37 +957,16 @@
       %7D%0A
-            else %7B%0A  
         
@@ -1004,31 +1004,19 @@
 ent(
-COMPRESSED_TRACK_FORMAT
+trackFormat
 , of
@@ -1040,30 +1040,16 @@
 ngth));%0A
-            %7D%0A
         
@@ -1091,16 +1091,23 @@
         
+return 
 doTrack(

Update volume.js