<commit_before>'use strict'

const { promisify } = require('util')

const fs = process.versions.electron ? require('original-fs') : require('fs')
const mkdirp = require('mkdirp')

const methods = [
  'lstat',
  'readFile',
  'stat',
  'writeFile'
]

for (const method of methods) {
  fs[method] = promisify(fs[method])
}
// To make it more like fs-extra
fs.mkdirp = promisify(mkdirp)
fs.mkdirpSync = mkdirp.sync

module.exports = fs<commit_msg>fix: don't monkeypatch fs with promisified versions (#176)<commit_after>'use strict'

const { promisify } = require('util')

const fs = process.versions.electron ? require('original-fs') : require('fs')
const mkdirp = require('mkdirp')

const promisifiedMethods = [
  'lstat',
  'readFile',
  'stat',
  'writeFile'
]

const promisified = {}

for (const method of Object.keys(fs)) {
  if (promisifiedMethods.includes(method)) {
    promisified[method] = promisify(fs[method])
  } else {
    promisified[method] = fs[method]
  }
}
// To make it more like fs-extra
promisified.mkdirp = promisify(mkdirp)
promisified.mkdirpSync = mkdirp.sync

module.exports = promisified
{'fraction_non_alphanumeric': 0.14491449144914492, 'fraction_numerical': 0.0027002700270027003, 'mean_word_length': 4.702564102564103, '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': '5728336', 'n_tokens_mistral': 403, 'n_tokens_neox': 385, 'n_words': 89}