<commit_before>const fs = require('fs');
const { promisify } = require('util');

for (const [key, value] of Object.entries(fs)) {
	if (key.includes('Sync')) continue;
	if (`${key}Sync` in fs) exports[key] = promisify(value);
	else exports[key] = value;
}

/* eslint-disable max-len */

/**
 * @namespace fsn/fs
 * @property {Object} constants Identical to fs.constants.
 * @property {integer} constants.F_OK Flag indicating that the file is visible to the calling process.
 * @property {integer} constants.R_OK Flag indicating that the file can be read by the calling process.
 * @property {integer} constants.W_OK Flag indicating that the file can be written by the calling process.
 * @property {integer} constants.X_OK Flag indicating that the file can be executed by the calling process.
 * @property {integer} constants.O_RDONLY Flag indicating to open a file for read-only access.
 * @property {integer} constants.O_WRONLY Flag indicating to open a file for write-only access.
 * @property {integer} constants.O_RDWR Flag indicating to open a file for read-write access.
 * @property {integer} constants.O_CREAT Flag indicating to create the file if it does not already exist.
 * @property {integer} constants.O_EXCL Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists.
 * @property {integer} constants.O_NOCTTY Flag indicating that if path identifies a terminal device, opening the path shall not cause that terminal to become the controlling terminal for the process (if the process does not already have one).
 * @property {integer} constants.O_TRUNC Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero.
 * @property {integer} constants.O_APPEND Flag indicating that data will be appended to the end of the file.
 * @property {integer} constants.O_DIRECTORY Flag indicating that the open should fail if the path is not a directory.
 * @property {integer} constants.O_NOATIME Flag indicating reading accesses to the file system will no longer result in an update to the atime information associated with the file. This flag is available on Linux operating systems only.
 * @property {integer} constants.O_NOFOLLOW Flag indicating that the open should fail if the path is a symbolic link.
 * @property {integer} constants.O_SYNC Flag indicating that the file is opened for synchronous I/O.
 * @property {integer} constants.O_SYMLINK Flag indicating to open the symbolic link itself rather than the resource it is pointing to.
 * @property {integer} constants.O_DIRECT When set, an attempt will be made to minimize caching effects of file I/O.
 * @property {integer} constants.O_NONBLOCK Flag indicating to open the file in nonblocking mode when possible.
 * @property {integer} constants.S_IFMT Bit mask used to extract the file type code.
 * @property {integer} constants.S_IFREG File type constant for a regular file.
 * @property {integer} constants.S_IFDIR File type constant for a directory.
 * @property {integer} constants.S_IFCHR File type constant for a character-oriented device file.
 * @property {integer} constants.S_IFBLK File type constant for a block-oriented device file.
 * @property {integer} constants.S_IFIFO File type constant for a FIFO/pipe.
 * @property {integer} constants.S_IFLNK File type constant for a symbolic link.
 * @property {integer} constants.S_IFSOCK File type constant for a socket.
 * @property {integer} constants.S_IRWXU File mode indicating readable, writable and executable by owner.
 * @property {integer} constants.S_IRUSR File mode indicating readable by owner.
 * @property {integer} constants.S_IWUSR File mode indicating writable by owner.
 * @property {integer} constants.S_IXUSR File mode indicating executable by owner.
 * @property {integer} constants.S_IRWXG File mode indicating readable, writable and executable by group.
 * @property {integer} constants.S_IRGRP File mode indicating readable by group.
 * @property {integer} constants.S_IWGRP File mode indicating writable by group.
 * @property {integer} constants.S_IXGRP File mode indicating executable by group.
 * @property {integer} constants.S_IRWXO File mode indicating readable, writable and executable by others.
 * @property {integer} constants.S_IROTH File mode indicating readable by others.
 * @property {integer} constants.S_IWOTH File mode indicating writable by others.
 * @property {integer} constants.S_IXOTH File mode indicating executable by others.
 */

/**
 * Objects returned from {@link fsn/fs.watch|watch()} are of this type.
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_fswatcher|fs.FSWatcher}.
 * @class FSWatcher
 * @fires FSWatcher#change
 * @fires FSWatcher#error
 */

/**
 * Emitted when an error occurs.
 * @event FSWatcher#change
 * @type {fsn/fs.FSWatcher}
 * @property {string} eventType The type of fs change
 * @property {string|Buffer} filename The filename that changed
 * @instance
 */

/**
 * Emitted when an error occurs.
 * @event FSWatcher#error
 * @type {fsn/fs.FSWatcher}
 * @property {Error} error The error
 * @instance
 */

/**
 * Closes the FSWatcher instance
 * @function close
 * @memberof FSWatcher
 * @instance
 */

/**
 * Objects returned from {@link fsn/fs.stat|stat()}, {@link fsn/fs.lstat|lstat()} and {@link fsn/fs.fstat|fstat()} are of this type.
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_stats|fs.Stats}.
 * @class Stats
 */

/**
 * @function isFile
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isDirectory
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isBlockDevice
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isCharacterDevice
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isSymbolicLink
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isFIFO
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isSocket
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_readstream|fs.ReadStream}.
 * @class ReadStream
 * @property {integer} bytesRead The number of bytes read so far
 * @property {string|Buffer} path The file the stream is reading from
 * @fires ReadStream#close
 * @fires ReadStream#open
 */

/**
 * Emitted when the readstream closes.
 * @event ReadStream#close
 * @instance
 */

/**
 * Emitted when the readstream's file is opened.
 * @event ReadStream#open
 * @property {integer} fd The file discriptor.
 * @instance
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_writestream|fs.WriteStream}.
 * @class WriteStream
 * @property {integer} bytesRead The number of bytes read so far
 * @property {string|Buffer} path The file the stream is reading from
 * @fires WriteStream#close
 * @fires WriteStream#open
 */

/**
 * Emitted when the readstream closes.
 * @event WriteStream#close
 * @instance
 */

/**
 * Emitted when the readstream's file is opened.
 * @event WriteStream#open
 * @property {integer} fd The file discriptor.
 * @instance
 */


/**
 * @typedef AppendFileOptions
 * @memberof fsn/fs
 * @property {string} [encoding = 'utf8'] The file encoding
 * @property {integer} [mode = 0o666] The chmod
 * @property {string} [flag = 'a'] The flag
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_fs_appendfile_file_data_options_callback|fs.appendFile} but returns a promise instead.<commit_msg>fix docs, from auto docs test<commit_after>const fs = require('fs');
const { promisify } = require('util');

for (const [key, value] of Object.entries(fs)) {
	if (key.includes('Sync')) continue;
	if (`${key}Sync` in fs) exports[key] = promisify(value);
	else exports[key] = value;
}

/* eslint-disable max-len */

/**
 * @namespace fsn/fs
 * @property {Object} constants Identical to fs.constants.
 * @property {integer} constants.F_OK Flag indicating that the file is visible to the calling process.
 * @property {integer} constants.R_OK Flag indicating that the file can be read by the calling process.
 * @property {integer} constants.W_OK Flag indicating that the file can be written by the calling process.
 * @property {integer} constants.X_OK Flag indicating that the file can be executed by the calling process.
 * @property {integer} constants.O_RDONLY Flag indicating to open a file for read-only access.
 * @property {integer} constants.O_WRONLY Flag indicating to open a file for write-only access.
 * @property {integer} constants.O_RDWR Flag indicating to open a file for read-write access.
 * @property {integer} constants.O_CREAT Flag indicating to create the file if it does not already exist.
 * @property {integer} constants.O_EXCL Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists.
 * @property {integer} constants.O_NOCTTY Flag indicating that if path identifies a terminal device, opening the path shall not cause that terminal to become the controlling terminal for the process (if the process does not already have one).
 * @property {integer} constants.O_TRUNC Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero.
 * @property {integer} constants.O_APPEND Flag indicating that data will be appended to the end of the file.
 * @property {integer} constants.O_DIRECTORY Flag indicating that the open should fail if the path is not a directory.
 * @property {integer} constants.O_NOATIME Flag indicating reading accesses to the file system will no longer result in an update to the atime information associated with the file. This flag is available on Linux operating systems only.
 * @property {integer} constants.O_NOFOLLOW Flag indicating that the open should fail if the path is a symbolic link.
 * @property {integer} constants.O_SYNC Flag indicating that the file is opened for synchronous I/O.
 * @property {integer} constants.O_SYMLINK Flag indicating to open the symbolic link itself rather than the resource it is pointing to.
 * @property {integer} constants.O_DIRECT When set, an attempt will be made to minimize caching effects of file I/O.
 * @property {integer} constants.O_NONBLOCK Flag indicating to open the file in nonblocking mode when possible.
 * @property {integer} constants.S_IFMT Bit mask used to extract the file type code.
 * @property {integer} constants.S_IFREG File type constant for a regular file.
 * @property {integer} constants.S_IFDIR File type constant for a directory.
 * @property {integer} constants.S_IFCHR File type constant for a character-oriented device file.
 * @property {integer} constants.S_IFBLK File type constant for a block-oriented device file.
 * @property {integer} constants.S_IFIFO File type constant for a FIFO/pipe.
 * @property {integer} constants.S_IFLNK File type constant for a symbolic link.
 * @property {integer} constants.S_IFSOCK File type constant for a socket.
 * @property {integer} constants.S_IRWXU File mode indicating readable, writable and executable by owner.
 * @property {integer} constants.S_IRUSR File mode indicating readable by owner.
 * @property {integer} constants.S_IWUSR File mode indicating writable by owner.
 * @property {integer} constants.S_IXUSR File mode indicating executable by owner.
 * @property {integer} constants.S_IRWXG File mode indicating readable, writable and executable by group.
 * @property {integer} constants.S_IRGRP File mode indicating readable by group.
 * @property {integer} constants.S_IWGRP File mode indicating writable by group.
 * @property {integer} constants.S_IXGRP File mode indicating executable by group.
 * @property {integer} constants.S_IRWXO File mode indicating readable, writable and executable by others.
 * @property {integer} constants.S_IROTH File mode indicating readable by others.
 * @property {integer} constants.S_IWOTH File mode indicating writable by others.
 * @property {integer} constants.S_IXOTH File mode indicating executable by others.
 */

/**
 * Objects returned from {@link fsn/fs.watch|watch()} are of this type.
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_fswatcher|fs.FSWatcher}.
 * @class FSWatcher
 * @fires FSWatcher#change
 * @fires FSWatcher#error
 */

/**
 * Emitted when an error occurs.
 * @event FSWatcher#change
 * @type {fsn/fs.FSWatcher}
 * @property {string} eventType The type of fs change
 * @property {string|Buffer} filename The filename that changed
 * @instance
 */

/**
 * Emitted when an error occurs.
 * @event FSWatcher#error
 * @type {fsn/fs.FSWatcher}
 * @property {Error} error The error
 * @instance
 */

/**
 * Closes the FSWatcher instance
 * @function close
 * @memberof FSWatcher
 * @instance
 */

/**
 * Objects returned from {@link fsn/fs.stat|stat()}, {@link fsn/fs.lstat|lstat()} and {@link fsn/fs.fstat|fstat()} are of this type.
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_stats|fs.Stats}.
 * @class Stats
 */

/**
 * @function isFile
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isDirectory
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isBlockDevice
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isCharacterDevice
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isSymbolicLink
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isFIFO
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * @function isSocket
 * @memberof Stats
 * @instance
 * @returns {boolean}
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_readstream|fs.ReadStream}.
 * @class ReadStream
 * @property {integer} bytesRead The number of bytes read so far
 * @property {string|Buffer} path The file the stream is reading from
 * @fires ReadStream#close
 * @fires ReadStream#open
 */

/**
 * Emitted when the readstream closes.
 * @event ReadStream#close
 * @instance
 */

/**
 * Emitted when the readstream's file is opened.
 * @event ReadStream#open
 * @property {integer} fd The file discriptor.
 * @instance
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_class_fs_writestream|fs.WriteStream}.
 * @class WriteStream
 * @property {integer} bytesRead The number of bytes read so far
 * @property {string|Buffer} path The file the stream is reading from
 * @fires WriteStream#close
 * @fires WriteStream#open
 */

/**
 * Emitted when the readstream closes.
 * @event WriteStream#close
 * @instance
 */

/**
 * Emitted when the readstream's file is opened.
 * @event WriteStream#open
 * @property {integer} fd The file discriptor.
 * @instance
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_fs_access_path_mode_callback|fs.access} but returns a promise instead.
 * @function access
 * @memberof fsn/fs
 * @param  {string|Buffer|URL} path The path to be checked
 * @param  {integer} [mode] The accessibility checks to be performed
 * @return {Promise<void>}
 */

/**
 * @typedef AppendFileOptions
 * @memberof fsn/fs
 * @property {string} [encoding = 'utf8'] The file encoding
 * @property {integer} [mode = 0o666] The chmod
 * @property {string} [flag = 'a'] The flag
 */

/**
 * Identical to {@link https://nodejs.org/api/fs.html#fs_fs_appendfile_file_data_options_callback|fs.appendFile} but returns a promise instead.
{'fraction_non_alphanumeric': 0.10137357322499517, 'fraction_numerical': 0.0006448700586831754, 'mean_word_length': 4.395963813500348, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 11, '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': '39151', 'n_tokens_mistral': 4516, 'n_tokens_neox': 4415, 'n_words': 1748}