Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-sync

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sync

A module for repeated efficient synchronizing two directories.

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is tree-sync?

The tree-sync npm package is designed to synchronize directories, ensuring that the contents of one directory match another. It is particularly useful for build systems and deployment scripts where maintaining consistent directory structures is crucial.

What are tree-sync's main functionalities?

Synchronize Directories

This feature allows you to synchronize the contents of a source directory with a destination directory. The code sample demonstrates how to use TreeSync to ensure that the destination directory matches the source directory.

const TreeSync = require('tree-sync');
const sourceDir = 'path/to/source';
const destDir = 'path/to/destination';
const tree = new TreeSync(sourceDir, destDir);
tree.sync();

Custom Filter Function

This feature allows you to provide a custom filter function to exclude certain files or directories from being synchronized. The code sample shows how to exclude files with a .tmp extension from the synchronization process.

const TreeSync = require('tree-sync');
const sourceDir = 'path/to/source';
const destDir = 'path/to/destination';
const tree = new TreeSync(sourceDir, destDir);
tree.sync({ filter: (relativePath) => !relativePath.endsWith('.tmp') });

Dry Run Mode

This feature allows you to perform a dry run to see what changes would be made without actually applying them. The code sample demonstrates how to use the dry run mode to preview the synchronization changes.

const TreeSync = require('tree-sync');
const sourceDir = 'path/to/source';
const destDir = 'path/to/destination';
const tree = new TreeSync(sourceDir, destDir);
tree.sync({ dryRun: true });

Other packages similar to tree-sync

FAQs

Package last updated on 05 Dec 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc