Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
File tree comparison and synchronization for Node.js!
$ npm install treediff
Instantiate like so:
var TreeDiff = require('treediff');
var treediff = new TreeDiff();
Will compare one file location with another one.
mapA
(Object) - The source to apply changes to
type
(String) - The type of the map. Default is "local"path
(String) - The path to the root folder of the sourcemapB
(Object) - The target to apply changes from
type
(String) - The type of the map. Default is "local"path
(String) - The path to the root folder of the sourcecallback(err, difference)
(Function) - The callback that is called when comparison is complete
err
(Error) - Any error that may occur during comparisondifference
(Object) - Holds information about which files were added, modified and deleted
added
(Array) - Files that are to be added to sourcemodified
(Array) - Files that are to be modified on sourcedeleted
(Array) - Files that are to be deleted on sourcetotal
(Number) - The total amount of differencesvar folderA = {
type: 'local',
path: 'path/to/folder-a'
};
var folderB = {
type: 'local',
path: 'path/to/folder-b'
};
treediff.compare(folderA, folderB, function(err, differences){
// ...
});
Will apply the differences from mapB to mapA.
mapA
(Object) - The source to apply changes to
type
(String) - The type of the map. Default is "local"path
(String) - The path to the root folder of the sourcemapB
(Object) - The target to apply changes from
type
(String) - The type of the map. Default is "local"path
(String) - The path to the root folder of the sourcecallback(err)
(Function) - The callback that is called when synchronization is complete
err
(Error) - Any error that may occur during synchronizationvar folderA = {
type: 'local',
path: 'path/to/folder-a'
};
var folderB = {
type: 'local',
path: 'path/to/folder-b'
};
treediff.sync(folderA, folderB, function(err){
// ...
});
Adds a filter to exlude entries from the comparison process. The filter will be evaluated for each entry as a glob expression. As an example, **/.DS_Store
is applied by default.
filter
(String) - The glob expression string to exclude entries by.// Exclude entire folder
treediff.registerFilter('**/Folder-to-exclude/**');
// Exclude all MS Word documents
treediff.registerFilter('**/*.docx');
FAQs
Compare and find/sync differences in file trees
The npm package treediff receives a total of 3 weekly downloads. As such, treediff popularity was classified as not popular.
We found that treediff demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.