dropbox-sdk-dotnet icon indicating copy to clipboard operation
dropbox-sdk-dotnet copied to clipboard

how to verify downloaded file?

Open ghiboz opened this issue 7 years ago • 6 comments

hello again, here is my code that I use to download a file:

using (var response = await client.Files.DownloadAsync(file.AsFile.PathDisplay))
{
    File.WriteAllBytes(folder + "/" + realName, await response.GetContentAsByteArrayAsync());
}

but my question is: how can I check if the downloaded file is correct? is there a checksum or md5 or someother thing?

thanks in advance

ghiboz avatar Aug 22 '16 06:08 ghiboz

The Dropbox API doesn't currently offer any sort of hash or checksum, but I'll be sure to pass this along as a feature request. If the download is interrupted though, an exception will be thrown.

greg-db avatar Aug 25 '16 17:08 greg-db

:+1: thanks @greg-db

ghiboz avatar Aug 26 '16 12:08 ghiboz

Hi, What news this issues? Thx.

andrewst avatar Mar 07 '17 06:03 andrewst

Recently, the API "FileMetadata" objects got a new "content_hash" field.

  • More information about that field: https://www.dropbox.com/developers/reference/content-hash
  • C# code to compute the hash: https://github.com/dropbox/dropbox-api-content-hasher/tree/master/csharp

cakoose avatar Mar 07 '17 10:03 cakoose

thx @cakoose it's very good. May be add DropboxContentHasher in sdk?

andrewst avatar Mar 07 '17 11:03 andrewst

Thanks Andrew! I can't make any promises, but we'll keep this open as a request to integrate that directly into the SDK.

greg-db avatar Mar 07 '17 19:03 greg-db