diffRemoteTrees
function diffRemoteTrees( source: RemoteFileSystem, sourcePath: string, destination: RemoteFileSystem, destinationPath: string,options?: DiffRemoteTreesOptions): Promise<RemoteTreeDiff>;Defined in: src/sync/diffRemoteTrees.ts:116
Compares two remote subtrees and produces an entry-level diff.
Source and destination paths are walked independently; entries are then aligned by the relative path from each tree root. Directory equality is structural - directories are equal when their relative paths match and the entry types agree.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
source | RemoteFileSystem | Source-side remote file system. |
sourcePath | string | Source-side root path being compared. |
destination | RemoteFileSystem | Destination-side remote file system. |
destinationPath | string | Destination-side root path being compared. |
options | DiffRemoteTreesOptions | Optional comparison controls. |
Returns
Section titled “Returns”Promise<RemoteTreeDiff>
Diff result containing entries and a summary.
Example
Section titled “Example”import { createSyncPlan, diffRemoteTrees } from "@zero-transfer/sdk";
const diff = await diffRemoteTrees( srcSession.fs, "/exports", dstSession.fs, "/exports", { compareUniqueId: true },);
console.log(diff.summary); // { added, removed, changed, unchanged }
const plan = createSyncPlan({ id: "exports-sync", diff, source: { provider: "sftp", rootPath: "/exports" }, destination: { provider: "sftp", rootPath: "/exports" },});