Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static async void GetImage(Uri uri, string filePath)
- {
- using(var client = new HttpClient())
- {
- using(var request = new HttpRequestMessage(HttpMethod.Get, uri))
- {
- using(Stream contentStream = await (
- await client.SendAsync(request)).Content.ReadAsStreamAsync(),
- stream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None, 3145728, true))
- {
- await contentStream.CopyToAsync(stream);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment