Log download speeds
This commit is contained in:
parent
84c83fd11d
commit
ec0972d7ba
1 changed files with 6 additions and 0 deletions
|
@ -160,6 +160,7 @@ Future<io.File> _downloadAndDecrypt(File file, BaseCacheManager cacheManager,
|
|||
|
||||
final encryptedFile = io.File(encryptedFilePath);
|
||||
final decryptedFile = io.File(decryptedFilePath);
|
||||
final startTime = DateTime.now().millisecondsSinceEpoch;
|
||||
return Dio()
|
||||
.download(
|
||||
file.getDownloadUrl(),
|
||||
|
@ -175,6 +176,11 @@ Future<io.File> _downloadAndDecrypt(File file, BaseCacheManager cacheManager,
|
|||
return null;
|
||||
}
|
||||
logger.info("File downloaded: " + file.uploadedFileID.toString());
|
||||
logger.info("Download speed: " +
|
||||
(io.File(encryptedFilePath).lengthSync() /
|
||||
(DateTime.now().millisecondsSinceEpoch - startTime))
|
||||
.toString() +
|
||||
"kBps");
|
||||
await CryptoUtil.decryptFile(encryptedFilePath, decryptedFilePath,
|
||||
Sodium.base642bin(file.fileDecryptionHeader), decryptFileKey(file));
|
||||
logger.info("File decrypted: " + file.uploadedFileID.toString());
|
||||
|
|
Loading…
Add table
Reference in a new issue