compare
title: Comparing directories
Comparing directories
This tutorial is part of package functions documentation in Iconify Tools.
Function [func]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:
[prop]dir1,[type]string. Directory.[prop]dir2,[type]string. Another directory.[prop]options,[type]object. Optional options.
Function returns:
trueif contents of directories are identical.falseif contents are different.
Function is asynchronous. That means you need to handle it as [class]Promise instance, usually by adding [js]await before function call.
Options
Options object has the following optional properties:
[prop]ignoreVersions,[type]boolean. Iftrue, version numbers in[file]package.jsonare ignored when comparing packages. Default istrue.[prop]ignoreNewLine,[type]boolean. Iftrue, differences in new line in text files are ignored when comparing text files. Default istrue.[prop]textExtensions,[type]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.
这篇文档对你有帮助吗?
谢谢你的反馈!