<commit_before>/**
 * Module dependencies
 */
var fs = require('fs-extra'),
	path = require('path'),
	async = require('async'),
	_ = require('lodash'),
	switchback = require('node-switchback');




/**
 * Generate a file using the specified string.
 *
 * @option {String} rootPath
 * @option {String} contents - the string contents to write to disk
 * [@option {Boolean} force=false]
 * [@option {Boolean} dry=false]
 *
 * @sb success
 * @sb error
 * @sb invalid
 * @sb alreadyExists
 */
module.exports = function ( options, sb ) {

	// Provide default values for switchback
	sb = switchback(sb, {
		alreadyExists: sb.error,
		invalid: sb.error
	});

	// Provide defaults and validate required options
	_.defaults(options, {
		force: false
	});
	var missingOpts = _.difference([
		'contents',
		'rootPath'
	], Object.keys(options));
	if ( missingOpts.length ) return sb.invalid(missingOpts);

	// In case we ended up here w/ a relative path,
	// resolve it using the process's CWD
	var rootPath = path.resolve( process.cwd() , options.rootPath );	
	// console.log('FileHelper trying to generate:',rootPath);

	// Only override an existing file if `options.force` is true
	fs.exists(rootPath, function (exists) {
		if (exists && !options.force) {
			console.log(rootPath);
			return sb.alreadyExists(rootPath);
		}

		// Don't actually write the file if this is a dry run.
		if (options.dry) return sb.success();

		async.series([
			function deleteExistingFileIfNecessary (cb) {<commit_msg>Use proper fs-extra dep.<commit_after>/**
 * Module dependencies
 */
var fs = require('fs-extra'),
	path = require('path'),
	async = require('async'),
	_ = require('lodash'),
	switchback = require('node-switchback');




/**
 * Generate a file using the specified string.
 *
 * @option {String} rootPath
 * @option {String} contents - the string contents to write to disk
 * [@option {Boolean} force=false]
 * [@option {Boolean} dry=false]
 *
 * @sb success
 * @sb error
 * @sb invalid
 * @sb alreadyExists
 */
module.exports = function ( options, sb ) {

	// Provide default values for switchback
	sb = switchback(sb, {
		alreadyExists: sb.error,
		invalid: sb.error
	});

	// Provide defaults and validate required options
	_.defaults(options, {
		force: false
	});
	var missingOpts = _.difference([
		'contents',
		'rootPath'
	], Object.keys(options));
	if ( missingOpts.length ) return sb.invalid(missingOpts);

	// In case we ended up here w/ a relative path,
	// resolve it using the process's CWD
	var rootPath = path.resolve( process.cwd() , options.rootPath );	
	// console.log('FileHelper trying to generate:',rootPath);

	// Only override an existing file if `options.force` is true
	fs.exists(rootPath, function (exists) {
		if (exists && !options.force) {
			// console.log(rootPath);
			return sb.alreadyExists(rootPath);
		}

		// Don't actually write the file if this is a dry run.
		if (options.dry) return sb.success();

		async.series([
			function deleteExistingFileIfNecessary (cb) {
{'fraction_non_alphanumeric': 0.13827655310621242, 'fraction_numerical': 0.0, 'mean_word_length': 3.7767145135566187, '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': '6242077', 'n_tokens_mistral': 981, 'n_tokens_neox': 916, 'n_words': 289}