
// POSIX IEEE P1003.1
// https://en.wikipedia.org/wiki/Tar_(computing)
// We want to relax the byte-range format in order to support plain
// strings that are read from a tarball, instead of requiring the 
// actual bytes array for parsing. 
const REGEXP = /^[^\s]+\d{6}\ \d{6}\ \d{6}\ \d{11}\ \d{11}/;

module.exports.type = "tar";

module.exports.is = function isTar( sample ) {
    var line = sample.toString().split( "\n" )[ 0 ];
    return REGEXP.test( line );
}

module.exports.parser = function () {
    var parser = require( "tar" ).Parser();
    parser.on( "entry", function () {

    })
}

module.exports.requires = [ "tar" ]
@@ -69,330 +69,345 @@
 ng)%0A
-// We want to relax the byte-range format in order to support plain%0A// strings that are read from a tarball, instead of requiring the %0A// actual bytes array for parsing. %0Aconst REGEXP = /%5E%5B%5E%5Cs%5D+%5Cd%7B6%7D%5C %5Cd%7B6%7D%5C %5Cd%7B6%7D%5C %5Cd%7B11%7D%5C %5Cd%7B11%7D/;%0A%0Amodule.exports.type = %22tar%22;%0A%0Amodule.exports.is = function isTar( sample ) %7B%0A    var li
+const REGEXP = /%5E%5B%5E%5Cs%5D+%5Cd%7B6%7D%5Cs(.%7B10%7D)/;%0A%0Amodule.exports.type = %22tar%22;%0A%0Amodule.exports.is = function isTar( sample ) %7B%0A    if ( !( sample instanceof Buffer ) ) %7B%0A        return false; // only buffers can represent tarballs%0A    %7D%0A%0A    // var fname = sample.slice( 0, 100 );%0A    var mode = sample.slice( 100, 107 ).toString();%0A    var ow
 ne
+r
  = s
@@ -416,66 +416,292 @@
 ple.
-toString().split( %22%5Cn%22 )%5B 0 %5D;%0A    return REGEXP.test( lin
+slice( 108, 115 ).toString();%0A    var group = sample.slice( 116, 123 ).toString();%0A    var size = sample.slice( 124, 135 ).toString();%0A%0A    return mode && +mode %3E 111 && +mode %3C 777%0A        && owner && !isNaN( owner )%0A        && group && !isNaN( group )%0A        && size && !isNaN( siz
 e );
@@ -750,20 +750,14 @@
     
-var parser =
+return
  req
@@ -779,59 +779,12 @@
 arse
-r
 ();%0A
-    parser.on( %22entry%22, function () %7B%0A%0A    %7D)%0A
 %7D%0A%0Am
@@ -817,8 +817,9 @@
  %22tar%22 %5D
+%0A

Guess tar by bytes-range format