Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP module for downloading files #1746

Merged
merged 3 commits into from
Jan 2, 2018

Conversation

vlukash
Copy link
Contributor

@vlukash vlukash commented Dec 10, 2017

No description provided.

@matthid
Copy link
Member

matthid commented Dec 15, 2017

Thanks a lot.
When we add a new Fake.<> namespace we need to add it here as well:

https://github.com/vlukash/FAKE/blob/1a8ba9ba009d94156a27982798ce9571ee113deb/build.fsx#L622-L631

This comment is more of a reminder for me before I merge this (but feel free to add it).

@vlukash
Copy link
Contributor Author

vlukash commented Dec 19, 2017

@matthid got it, thanks

Updated build.fsx and added functionality for parallel downloading
Ready for review, please share your thoughts on API/improvements

Current API is :

Single file download

downloadFile (localFilePath: string) (uri: string) : Result<string, string list> 

Usage example

Http.downloadFile "5.zip" @"http://ipv4.download.thinkbroadband.com/5MB.zip" |> ignore

Download in parallel:

downloadFiles (input: DownloadParameters list) : Result<string list, string list>

Usage example

let files: Http.DownloadParameters list = [
    {Path = "5.zip"; Uri = @"http://ipv4.download.thinkbroadband.com/5MB.zip"};
    {Path = "10.zip"; Uri = @"http://ipv4.download.thinkbroadband.com/10MB.zip"}]
let result = Http.downloadFiles files
match result with
    | Ok files ->
        printfn "%A" files
    | Error err ->
        printfn "%A" err

@vlukash vlukash changed the title [WIP] Add HTTP module for downloading files Add HTTP module for downloading files Dec 19, 2017
@matthid
Copy link
Member

matthid commented Jan 2, 2018

My thoughts are:

  • It's good to have this ;)
  • I'd prefer throwing exceptions by default, because I think that is what other APIs are doing
  • We can have this as is but I think I add a try prefix to the function names
  • Namespace and module are fine (I like Fake.Net.Http)

The only other thing is if we want to have some docs for this, but we can improve this along the way.
Thanks a lot.

@matthid matthid merged commit c666715 into fsprojects:master Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants