<commit_before>/*#ifndef(UMD)*/
"use strict";
/*global _GPF_EVENT_ERROR*/ // gpf.events.EVENT_ERROR
/*global _GPF_EVENT_READY*/ // gpf.events.EVENT_READY
/*global _GPF_FS_TYPE_DIRECTORY*/ // _GPF_FS_TYPE_DIRECTORY
/*global _GPF_FS_TYPE_FILE*/ // _GPF_FS_TYPE_FILE
/*global _GPF_FS_TYPE_NOT_FOUND*/ // _GPF_FS_TYPE_NOT_FOUND
/*global _GPF_FS_TYPE_UNKNOWN*/ // _GPF_FS_TYPE_UNKNOWN
/*global _gpfDefine*/ // Shortcut for gpf.define
/*global _gpfEventsFire*/ // gpf.events.fire (internal, parameters must match)
/*global _gpfFsExploreEnumerator*/ // IFileStorage.explore helper
/*global _gpfInNode*/ // The current host is a nodeJS like
/*global _gpfNodeFs:true*/ // Node require("fs")
/*global _gpfNodePath*/ // Node require("path")
/*global _GpfNodeStream*/ // gpf.stream.Node
/*global _gpfPathNormalize*/ // Normalize path
/*#endif*/

/*jshint node:true*/
/*eslint-env node*/

/**
 * Helper to wrap node error
 *
 * @param {*} err
 * @param {gpf.events.Handler} eventsHandler
 */
function _gpfFireNodeError (err, eventsHandler) {
    _gpfEventsFire(_GPF_EVENT_ERROR, {error: err}, eventsHandler);
}

/**
 * Generate one of the calls based on a method name
 *
 * @param {String} methodName
 * @return {Function]
 * @closure
 */
function _gpfGenFsCall(methodName) {
    return function (path, eventsHandler) {
        path = _gpfPathNormalize(path);
        _gpfNodeFs[methodName](path, function (err) {
            if (err) {
                _gpfFireNodeError(err, eventsHandler);
            } else {
                _gpfEventsFire(_GPF_EVENT_READY, {}, eventsHandler);
            }
        });
    };
}

_gpfDefine("gpf.fs.NodeFileStorage", Object, {
    public: {

        constructor: function () {
            if (!_gpfNodeFs) {
                _gpfNodeFs = require("fs");
            }
        },

        //region IFileStorage

        // @inheritdoc IFileStorage#getInfo<commit_msg>Eslint fixes<commit_after>/*#ifndef(UMD)*/
"use strict";
/*global _GPF_EVENT_ERROR*/ // gpf.events.EVENT_ERROR
/*global _GPF_EVENT_READY*/ // gpf.events.EVENT_READY
/*global _GPF_FS_TYPE_DIRECTORY*/ // _GPF_FS_TYPE_DIRECTORY
/*global _GPF_FS_TYPE_FILE*/ // _GPF_FS_TYPE_FILE
/*global _GPF_FS_TYPE_NOT_FOUND*/ // _GPF_FS_TYPE_NOT_FOUND
/*global _GPF_FS_TYPE_UNKNOWN*/ // _GPF_FS_TYPE_UNKNOWN
/*global _gpfDefine*/ // Shortcut for gpf.define
/*global _gpfEventsFire*/ // gpf.events.fire (internal, parameters must match)
/*global _gpfFsExploreEnumerator*/ // IFileStorage.explore helper
/*global _gpfInNode*/ // The current host is a nodeJS like
/*global _gpfNodeFs:true*/ // Node require("fs")
/*global _gpfNodePath*/ // Node require("path")
/*global _GpfNodeStream*/ // gpf.stream.Node
/*global _gpfPathNormalize*/ // Normalize path
/*#endif*/

/*jshint node:true*/
/*eslint-env node*/

/**
 * Helper to wrap node error
 *
 * @param {*} err
 * @param {gpf.events.Handler} eventsHandler
 */
function _gpfFireNodeError (err, eventsHandler) {
    _gpfEventsFire(_GPF_EVENT_ERROR, {error: err}, eventsHandler);
}

/**
 * Generate one of the calls based on a method name
 *
 * @param {String} methodName
 * @return {Function]
 * @closure
 */
function _gpfGenFsCall (methodName) {
    return function (path, eventsHandler) {
        path = _gpfPathNormalize(path);
        _gpfNodeFs[methodName](path, function (err) {
            if (err) {
                _gpfFireNodeError(err, eventsHandler);
            } else {
                _gpfEventsFire(_GPF_EVENT_READY, {}, eventsHandler);
            }
        });
    };
}

_gpfDefine("gpf.fs.NodeFileStorage", Object, {
    public: {

        constructor: function () {
            if (!_gpfNodeFs) {
                _gpfNodeFs = require("fs");
            }
        },

        //region IFileStorage

        // @inheritdoc IFileStorage#getInfo
{'fraction_non_alphanumeric': 0.1355214399152991, 'fraction_numerical': 0.0, 'mean_word_length': 3.041711229946524, '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': '3253525', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1271, 'n_words': 263}