Skip to content

Commit 86f0354

Browse files
committed
Add Fake.Net.Http documentation
1 parent c1a6780 commit 86f0354

File tree

4 files changed

+77
-3
lines changed

4 files changed

+77
-3
lines changed

FAKE.sln

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "markdown", "markdown", "{B9
8585
help\markdown\legacy-core-targets.md = help\markdown\legacy-core-targets.md
8686
help\markdown\legacy-gettingstarted.md = help\markdown\legacy-gettingstarted.md
8787
help\markdown\legacy-index.md = help\markdown\legacy-index.md
88+
help\markdown\net-http.md = help\markdown\net-http.md
8889
help\markdown\testing-sonarqube.md = help\markdown\testing-sonarqube.md
8990
help\markdown\todo-androidpublisher.md = help\markdown\todo-androidpublisher.md
9091
help\markdown\todo-azurecloudservices.md = help\markdown\todo-azurecloudservices.md

help/markdown/net-http.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Downloading Files Over HTTP
2+
3+
The `Fake.Net.Http` module provides a functionality to download files over HTTP.
4+
5+
[API-Reference](apidocs/fake-net-http.html)
6+
7+
## Including the Fake.Net.Http dependency
8+
9+
In order to open the `Fake.Net.Http` module from a build script you have to add a `Fake.Net.Http` dependency into your
10+
`paket.dependencies` file:
11+
12+
group NetcoreBuild
13+
source https://api.nuget.org/v3/index.json
14+
15+
nuget Fake.Net.Http prerelease
16+
17+
.... other dependencies, like
18+
nuget Fake.Core.Target prerelease
19+
20+
Please see more details on referencing FAKE 5 modules [here](apidocs/fake-fake5-modules.html).
21+
22+
## Downloading a Single File
23+
24+
To download a single file over HTTP use `downloadFile` from the Http module:
25+
26+
open Fake.Net
27+
open Fake.Core
28+
29+
Target.Create "DownloadFile" (fun _ ->
30+
let absoluteFilePath = Http.downloadFile "/tmp/5.zip" @"http://ipv4.download.thinkbroadband.com/5MB.zip"
31+
printfn "File path: %s" absoluteFilePath
32+
)
33+
34+
A console output should be:
35+
36+
Downloading [http://ipv4.download.thinkbroadband.com/5MB.zip] ...
37+
Download succeeded
38+
File path: /tmp/5.zip
39+
40+
## Downloading Multiple Files
41+
42+
To download multiple files in parallel use `downloadFiles` from the Http module:
43+
44+
open Fake.Net
45+
open Fake.Core
46+
47+
Target.Create "DownloadFiles" (fun _ ->
48+
let files: Http.DownloadParameters list = [
49+
{Path = "/tmp/5.zip"; Uri = "http://ipv4.download.thinkbroadband.com/5MB.zip"};
50+
{Path = "/tmp/10.zip"; Uri = "http://ipv4.download.thinkbroadband.com/10MB.zip"}]
51+
let filePaths = Http.downloadFiles files
52+
printfn "File paths: %A" filePaths
53+
)
54+
55+
A console output should be:
56+
57+
Downloading [http://ipv4.download.thinkbroadband.com/5MB.zip] ...
58+
Downloading [http://ipv4.download.thinkbroadband.com/10MB.zip] ...
59+
Download succeeded
60+
File paths: ["/tmp/5.zip"; "/tmp/10.zip"]
61+
62+
## More Details
63+
64+
* `downloadFile` and `downloadFiles` throw an Exception and fail a FAKE Target if any error occurs (invalid URI, invalid local file
65+
path/permissions, etc.)
66+
67+
* file with the same name will be overwritten if exists in the target location

help/templates/template.cshtml

+7-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@
112112
<li><a href="@(prefix)apidocs/fake-dotnet-paket.html">Paket</a></li>
113113
</ul>
114114
</li>
115+
<li>
116+
<a href="@(prefix)apidocs/index.html#Fake.Net">Net</a>
117+
<ul>
118+
<li><a href="@(prefix)net-http.html">Http</a></li>
119+
</ul>
120+
</li>
115121
<li>
116122
<a href="@(prefix)apidocs/index.html#Fake.Tools.Git">Tools</a>
117123
<ul>
@@ -297,4 +303,4 @@
297303
<script src="@(prefix)assets/js/main.js"></script>
298304

299305
</body>
300-
</html>
306+
</html>

src/app/Fake.Net.Http/AssemblyInfo.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ open System.Reflection
55
[<assembly: AssemblyTitleAttribute("FAKE - F# Make HTTP Client")>]
66
[<assembly: AssemblyProductAttribute("FAKE - F# Make")>]
77
[<assembly: AssemblyVersionAttribute("5.0.0")>]
8-
[<assembly: AssemblyInformationalVersionAttribute("5.0.0-beta010")>]
8+
[<assembly: AssemblyInformationalVersionAttribute("5.0.0")>]
99
[<assembly: AssemblyFileVersionAttribute("5.0.0")>]
1010
do ()
1111

1212
module internal AssemblyVersionInformation =
1313
let [<Literal>] AssemblyTitle = "FAKE - F# Make HTTP Client"
1414
let [<Literal>] AssemblyProduct = "FAKE - F# Make"
1515
let [<Literal>] AssemblyVersion = "5.0.0"
16-
let [<Literal>] AssemblyInformationalVersion = "5.0.0-beta010"
16+
let [<Literal>] AssemblyInformationalVersion = "5.0.0"
1717
let [<Literal>] AssemblyFileVersion = "5.0.0"

0 commit comments

Comments
 (0)