<commit_before>
// asar-aware filesystem module
import fs from 'fs'

export async function readFile (file) {
  return await new Promise((resolve, reject) => {
    fs.readFile(file, {encoding: 'utf8'}, (err, res) => {
      if (err) {
        return reject(err)
      }
      resolve(res)
    })
  })
}

// XXX we can't use fs.access via ASAR, it always returns false
export async function exists (file) {
  try {
    await readFile(file)
  } catch (err) {
    return false
  }
  return true
}

import {writeFile as sfWriteFile} from '../util/sf'
export const writeFile = sfWriteFile
export default {readFile, writeFile, exists}<commit_msg>Actually fix locales downloads<commit_after>
// asar-aware filesystem module
import fs from 'fs'

export async function readFile (file) {
  return await new Promise((resolve, reject) => {
    fs.readFile(file, {encoding: 'utf8'}, (err, res) => {
      if (err) {
        return reject(err)
      }
      resolve(res)
    })
  })
}

// XXX we can't use fs.access via ASAR, it always returns false
export async function exists (file) {
  try {
    await readFile(file)
  } catch (err) {
    return false
  }
  return true
}

import sf from '../util/sf'
export const writeFile = sf.writeFile
export default {readFile, writeFile, exists}
{'fraction_non_alphanumeric': 0.11871069182389937, 'fraction_numerical': 0.0015723270440251573, 'mean_word_length': 3.0932475884244375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3913260', 'n_tokens_mistral': 405, 'n_tokens_neox': 399, 'n_words': 136}