Chase.Networking
0.0.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Chase.Networking --version 0.0.4
NuGet\Install-Package Chase.Networking -Version 0.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Chase.Networking" Version="0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chase.Networking --version 0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Chase.Networking, 0.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Chase.Networking as a Cake Addin #addin nuget:?package=Chase.Networking&version=0.0.4 // Install Chase.Networking as a Cake Tool #tool nuget:?package=Chase.Networking&version=0.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Chase.Networking
a simple networking library
Create Client
using Chase.Networking;
// ...
using NetworkClient client = new NetworkClient();
Download File
client.DownloadFileAsync("https://example.com/download.zip", "/path/to/download.zip");
Getting additional download information
Additional information that can be received is as follows:
Bytes Downloaded
- The total amount of bytes that have been downloaded,Bytes Per Second
- The speed of the download in bps,Bytes Remaining
- The number of bytes that are left to be downloaded,Percentage
- The percent of the file that has been downloaded, value is a float between 0 and 1,Total Bytes To Receive
- The total size of the downloading file,
DownloadProgressEvent progressEvent = (s, e) =>
{
Console.WriteLine($"Download Progress {e.Percentage:P2}%");
Console.WriteLine($"Download Speed {e.BytesPerSecond}bps");
Console.WriteLine($"Downloaded {e.BytesDownloaded}bytes / {e.TotalBytesToReceive}bytes");
Console.WriteLine($"Remaining {e.BytesRemaining}bytes");
};
client.DownloadFileAsync("https://example.com/download.zip", "/path/to/download.zip", progressEvent);
Get Request as Newtonsoft.JSON
A normal get request
JObject? jObject = await client.GetAsJson("https://api.example.com");
JArray? jArray = await client.GetAsJsonArray("https://api.example.com");
or you can also pass a HttpRequestMessage
for more advanced requests
using HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.example.com");
JObject? jObject = await client.GetAsJson(request);
JArray? jArray = await client.GetAsJsonArray(request);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
added the ability to pass a directory through to download file function, which will attempt to get the filename from the header content distribution tag, or a randomly generated name.