downloadFile method
Implementation
@override
Future<bool> downloadFile(String fileId, String saveName, {String? bucketId}) async {
try {
if(kIsWeb) {
bucketId ??= myConfig!.serverConfig.storageConnInfo.bucketId;
Uint8List? targetBytes = await getFileBytes(fileId, bucketId: bucketId);
String targetUrl = Url.createObjectUrlFromBlob(Blob([targetBytes]));
AnchorElement(href: targetUrl)
..setAttribute("download", saveName)
..click();
Url.revokeObjectUrl(targetUrl);
return true;
}
} catch (error) {
logger.info("error during Storage.downloadFile >>> $error");
}
return false;
}