<commit_before>var fs = require('fs')
var assert = require('assert')

function readFile (fp, opts, cb) {
  if (arguments.length === 1) return fs.readFileSync(fp, 'utf8')

  if (arguments.length === 2) {
    if (typeof opts === 'function') {
      cb = opts
      opts = 'utf8'
    } else {
      return fs.readFileSync(fp, opts)
    }
  }

  fs.readFile(fp, opts, function (err, data) {
    assert.ifError(err)
    cb(null, data)
  })
}

function readStream (fp, opts) {
  return fs.createReadStream(fp, opts)
}

module.exports = readFile
module.exports.stream = readStream<commit_msg>update file/readFile — minor streamline <commit_after>var fsreadFile = require('fs').readFile
var fsreadFileSync = require('fs').readFileSync
var assert = require('assert')

function readFile (fp, opts, cb) {
  if (arguments.length === 1) return fsreadFileSync(fp, 'utf8')

  if (arguments.length === 2) {
    if (typeof opts === 'function') {
      cb = opts
      opts = 'utf8'
    } else {
      return fsreadFileSync(fp, opts)
    }
  }

  fsreadFile(fp, opts, function (err, data) {
    assert.ifError(err)
    cb(null, data)
  })
}

// function readStream (fp, opts) {
//   return fs.createReadStream(fp, opts)
// }

module.exports = readFile
// module.exports.stream = readStream
{'fraction_non_alphanumeric': 0.14948859166011014, 'fraction_numerical': 0.006294256490952006, 'mean_word_length': 3.326530612244898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '312742', 'n_tokens_mistral': 438, 'n_tokens_neox': 429, 'n_words': 109}