Chase.Networking 0.0.7

Suggested Alternatives

Chase.CommonLib

dotnet add package Chase.Networking --version 0.0.7
NuGet\Install-Package Chase.Networking -Version 0.0.7
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.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chase.Networking --version 0.0.7
#r "nuget: Chase.Networking, 0.0.7"
#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.7

// Install Chase.Networking as a Cake Tool
#tool nuget:?package=Chase.Networking&version=0.0.7

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 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.7 138 9/14/2023
0.0.6 100 9/13/2023
0.0.5 102 9/13/2023
0.0.4 116 9/12/2023
0.0.3 128 7/27/2023
0.0.2 132 7/27/2023
0.0.1 146 7/23/2023

Added upload file method