<commit_before>
// 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" ]<commit_msg>Guess tar by bytes-range format<commit_after>
// POSIX IEEE P1003.1
// https://en.wikipedia.org/wiki/Tar_(computing)
const REGEXP = /^[^\s]+\d{6}\s(.{10})/;

module.exports.type = "tar";

module.exports.is = function isTar( sample ) {
    if ( !( sample instanceof Buffer ) ) {
        return false; // only buffers can represent tarballs
    }

    // var fname = sample.slice( 0, 100 );
    var mode = sample.slice( 100, 107 ).toString();
    var owner = sample.slice( 108, 115 ).toString();
    var group = sample.slice( 116, 123 ).toString();
    var size = sample.slice( 124, 135 ).toString();

    return mode && +mode > 111 && +mode < 777
        && owner && !isNaN( owner )
        && group && !isNaN( group )
        && size && !isNaN( size );
}

module.exports.parser = function () {
    return require( "tar" ).Parse();
}

module.exports.requires = [ "tar" ]

{'fraction_non_alphanumeric': 0.17873450750163078, 'fraction_numerical': 0.03587736464448793, 'mean_word_length': 2.825436408977556, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2170596', 'n_tokens_mistral': 561, 'n_tokens_neox': 505, 'n_words': 147}