Comparing directories
This tutorial is part of package functions documentation in Iconify Tools.
Function compareDirectories() compares contents of two directories.
It is used to check if package generated by one of export functions and package downloaded from elsewhere, such as NPM package are identical. If packages are identical, there is no need to publish a new version.
Usage
Function has the following parameters:
- dir1, string. Directory.
- dir2, string. Another directory.
- options, object. Optional options.
Function returns:
- true if contents of directories are identical.
- false if contents are different.
Function is asynchronous. That means you need to handle it as Promise instance, usually by adding await before function call.
Options
Options object has the following optional properties:
- ignoreVersions, boolean. If true, version numbers in package.json are ignored when comparing packages. Default is true.
- ignoreNewLine, boolean. If true, differences in new line in text files are ignored when comparing text files. Default is true.
- textExtensions, string[]. List of extensions to treat as text files. Default list includes all formats exported by various functions, but you can use this to add other extensions. Extensions should be in lower case.