{"library":"rsync","title":"Rsync CLI Wrapper","description":"node-rsync is a Node.js library that provides a programmatic interface for building and executing `rsync` commands. It functions as a wrapper around the system's `rsync` utility, allowing developers to construct complex synchronization commands using a fluent API in JavaScript or TypeScript applications. The current stable version is 0.6.1. Releases are infrequent, typically addressing specific bugs or adding minor enhancements (such as Windows path support), rather than following a strict cadence. Its primary utility lies in automating file synchronization, backup tasks, and deployments within Node.js environments by abstracting the command-line intricacies of `rsync` into a more manageable, object-oriented structure.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install rsync"],"cli":null},"imports":["const Rsync = require('rsync');","import Rsync from 'rsync';","import Rsync from 'rsync';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const Rsync = require('rsync');\n\n// 1. Build the rsync command configuration\nconst rsync = new Rsync()\n  .shell('ssh')                 // Use SSH for remote connections\n  .flags('az')                 // 'a' for archive mode, 'z' for compress\n  .source('/path/to/local/source/') // Local directory to synchronize from\n  .destination('user@remote.server:/path/to/remote/destination/'); // Remote destination\n\n// 2. Execute the command and handle results\nrsync.execute(function(error, code, cmd) {\n    if (error) {\n        console.error('Rsync command failed:', error.message);\n        console.error('Exit Code:', code);\n        console.error('Executed Command:', cmd);\n        // Depending on `code`, you might want to retry or log specific errors\n    } else {\n        console.log('Rsync command completed successfully.');\n        console.log('Executed Command:', cmd);\n        // Further processing after successful synchronization\n    }\n});\n","lang":"javascript","description":"Demonstrates how to initialize an Rsync instance, configure a basic remote synchronization command using SSH, common flags (archive, compress), and then execute it with error handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}