downloadPath function
Future<TransferResult>
downloadPath({})
Downloads remotePath from nodeId to the local localDest (a directory to
write into, or an explicit target path — see FileTransferEngine.runReceiver;
destIsDir forces directory mode), resuming any partial files and verifying
each file's SHA-256.
Implementation
Future<TransferResult> downloadPath({
required ClientRuntime client,
required String nodeId,
required String remotePath,
required String localDest,
bool destIsDir = false,
int gzipLevel = kDefaultGzipLevel,
void Function(TransferProgress)? onProgress,
Future<bool> Function(TransferPreflight)? confirm,
}) async {
final session = await _openTransfer(
client,
nodeId: nodeId,
direction: 'download',
remotePath: remotePath,
gzipLevel: gzipLevel,
);
try {
final engine = FileTransferEngine(ClientTransferLink(session));
final result = await engine.runReceiver(
dest: localDest,
destIsDir: destIsDir,
onProgress: onProgress,
confirm: confirm,
);
await session.exitCode;
return result;
} finally {
await session.close();
}
}