Skip to content

Method CalculateChecksumAsync

Namespace: Belay.Sync
Assembly: Belay.Sync.dll

CalculateChecksumAsync(string, string, CancellationToken)

Calculates a checksum for the specified file.

csharp
public Task<string> CalculateChecksumAsync(string path, string algorithm = "md5", CancellationToken cancellationToken = default)

Parameters

path string

The file path to calculate checksum for.

algorithm string

The checksum algorithm to use (e.g., "md5", "sha256").

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<string>

The hexadecimal checksum string.

Exceptions

FileNotFoundException

Thrown when the file does not exist.

NotSupportedException

Thrown when the algorithm is not supported.

Released under the Apache License 2.0.