downloadFromPath method
Download a file by remote path to a local destination.
Example: client.downloadFromPath('/Documents/report.pdf', '/tmp/');
Implementation
Future<Map<String, dynamic>> downloadFromPath(
String remotePath, {
String? localDestination,
}) async {
final resolved = await resolvePath(remotePath);
if (resolved['type'] != 'file') {
throw Exception("'$remotePath' is not a file");
}
final savePath = localDestination != null
? (FileSystemEntity.isDirectorySync(localDestination)
? p.join(localDestination, p.basename(remotePath))
: localDestination)
: p.basename(remotePath);
return downloader.downloadFile(resolved['uuid'], savePath: savePath);
}