Skip to content

Instantly share code, notes, and snippets.

@gazlu
Created October 6, 2016 18:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gazlu/1eded0c78d7bf0057cb609da752cb990 to your computer and use it in GitHub Desktop.
Save gazlu/1eded0c78d7bf0057cb609da752cb990 to your computer and use it in GitHub Desktop.
Download Image or file with RestSharp (Rest Sharp)
RestClient restClient = new RestClient(@"http://ia.media-imdb.com/images/M/MV5BMjM5OTQ1MTY5Nl5BMl5BanBnXkFtZTgwMjM3NzMxODE@._V1_SX300.jpg");
var fileBytes = restClient.DownloadData(new RestRequest("#", Method.GET));
File.WriteAllBytes(Path.Combine(directory, "poster-got.jpg"), fileBytes);
@MorningZ
Copy link

Thank you for this, works great to pull user photos out of Microsoft Graph API

@nadvolod
Copy link

nadvolod commented Feb 19, 2021

Also worked for me :) Thanks!

@acordobaj
Copy link

what is directory?

@MorningZ
Copy link

what is directory?

The string value of the directory to store file in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment