<commit_before>#!/usr/bin/env node
'use strict';

var Flags = require('minimist')(process.argv.slice(2)),
      Fs = require('fs'),
      Path = require('path'),
      GzipSize = require('gzip-size'),
      PrettyBytes = require('pretty-bytes'),
      Colors = require('colors');

if (!Flags.file) {
  process.exit(1);
}

let totalSize = 0,
    totalGzippedSize = 0,
    filePath = Path.resolve(process.cwd(), Flags.file);

var rawSize = Fs.statSync(filePath).size;
totalSize = PrettyBytes(rawSize);
var rawGzippedSize = GzipSize.sync(Fs.readFileSync(filePath, 'utf8'));
totalGzippedSize = PrettyBytes(rawGzippedSize);

console.log('\n');
console.log('=============================== FileSize summary ===============================');
console.log(`The total size of ${Path.basename(filePath)} is ${Colors.green(totalSize)}.`);
console.log(`The total gzipped size of ${Path.basename(filePath)} is ${Colors.green(totalGzippedSize)}.`);
console.log('================================================================================');
console.log('\n');

if (Flags.max) {
  var max = Number(Flags.max) * 1000; // kb to bytes
  if (max > totalSize) {
    process.exitCode = 1;<commit_msg>Update filesize.js to simple use .gz version of the compiled file<commit_after>#!/usr/bin/env node
'use strict';

var Flags = require('minimist')(process.argv.slice(2)),
      Fs = require('fs'),
      Path = require('path'),
      PrettyBytes = require('pretty-bytes'),
      Colors = require('colors');

if (!Flags.file) {
  process.exit(1);
}

let totalSize = 0,
    totalGzippedSize = 0,
    filePath = Path.resolve(process.cwd(), Flags.file);

var rawSize = Fs.statSync(filePath).size;
totalSize = PrettyBytes(rawSize);
var rawGzippedSize = Fs.statSync(`${filePath}.gz`).size;
totalGzippedSize = PrettyBytes(rawGzippedSize);

console.log('\n');
console.log('=============================== FileSize summary ===============================');
console.log(`The total size of ${Path.basename(filePath)} is ${Colors.green(totalSize)}.`);
console.log(`The total gzipped size of ${Path.basename(filePath)} is ${Colors.green(totalGzippedSize)}.`);
console.log('================================================================================');
console.log('\n');

if (Flags.max) {
  var max = Number(Flags.max) * 1000; // kb to bytes
  if (max > totalSize) {
    process.exitCode = 1;
{'fraction_non_alphanumeric': 0.27629911280101394, 'fraction_numerical': 0.008027038445289396, 'mean_word_length': 5.348525469168901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '5768271', 'n_tokens_mistral': 759, 'n_tokens_neox': 736, 'n_words': 154}