Skip to content

file-processor

Classes

FileProcessor

The FileProcessor class provides functionalities to process files within a specified folder. It offers methods to print, parse, write, and filter files based on the provided arguments and configurations.

Typedefs

PluginOptions

Represents the plugin options provided to the application.

FolderData

Represents the data of a folder, including its paths, tree structure, and excluded files.

ParseReturn

Represents the return value after parsing a file.

FileProcessor

The FileProcessor class provides functionalities to process files within a specified folder. It offers methods to print, parse, write, and filter files based on the provided arguments and configurations.

Kind: global class

fileProcessor.processFiles(lsFolder, options) ⇒ Promise.<Array.<ParseReturn>>

Processes the files within the specified folder based on the provided arguments.

Kind: instance method of FileProcessor
Returns: Promise.<Array.<ParseReturn>> - A promise that resolves to an array of processed files.

ParamTypeDescription
lsFolderFolderDataData representing the folder and its contents.
optionsPluginOptionsplugin options to guide the file processing.

Example

js
const processor = new FileProcessor();
const processedFiles = await processor.processFiles(folderData, cliArgs);
const processor = new FileProcessor();
const processedFiles = await processor.processFiles(folderData, cliArgs);

PluginOptions

Represents the plugin options provided to the application.

Kind: global typedef
Properties

NameTypeDescription
diststringDestination path for the generated files.
excludestringPatterns to exclude from processing.
folderstringMain folder for processing.
helpersArray.<string>List of helper functions or modules.
includestringPatterns to include for processing.
jsDocConfigPathstringPath to the JSDoc configuration file.
partialsArray.<string>List of partial templates or modules.
readmestringPath to the README file.
rmPatternArray.<string>Patterns for files to be removed.
sourcestringSource path for the files to be processed.
titlestringTitle for the generated documentation.
watchbooleanFlag to determine if the application should watch for file changes.

FolderData

Represents the data of a folder, including its paths, tree structure, and excluded files.

Kind: global typedef
Properties

NameTypeDescription
excludedArray.<DirectoryFile>List of excluded files.
pathsArray.<DirectoryFile>List of all paths in the folder.
treeArray.<FileTree>Tree structure of the folder.

ParseReturn

Represents the return value after parsing a file.

Kind: global typedef
Properties

NameTypeDescription
contentstringContent of the parsed file.
deststringDestination path for the parsed file.
emptybooleanFlag to determine if the file is empty.
[excluded]booleanFlag to determine if the file was excluded.
fileDirectoryFileDetails of the parsed file.
relativePathDeststringRelative destination path for the parsed file.
relativePathSrcstringRelative source path of the parsed file.
[success]booleanFlag to determine if the parsing was successful.
[type]StatisticTypeType of statistic for the parsed file.

Released under the MIT License.