writeDownloadMetadata function
Write metadata about a file in the local directory related to a download process.
Args:
local_dir (Path
):
Path to the local directory in which files are downloaded.
Implementation
Future<void> writeDownloadMetadata({
required String localDir,
required String filename,
required String commitHash,
required String etag,
}) async {
final paths = await getLocalDownloadPaths(localDir: localDir, filename: filename);
await WeakFileLock(paths.lockPath, () async {
await File(paths.metadataPath).writeAsString('$commitHash\n$etag\n${unixTimestamp()}\n');
});
}