HttpStream 2.0.50

Install-Package HttpStream -Version 2.0.50
dotnet add package HttpStream --version 2.0.50
<PackageReference Include="HttpStream" Version="2.0.50" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HttpStream --version 2.0.50
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HttpStream, 2.0.50"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install HttpStream as a Cake Addin
#addin nuget:?package=HttpStream&version=2.0.50

// Install HttpStream as a Cake Tool
#tool nuget:?package=HttpStream&version=2.0.50
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

HttpStream

This C# project implements randomly accessible stream on HTTP 1.1 transport. Typically, HttpClient provides almost all HTTP features but it just provides us with a way to download a file completely. The implementation take advantage of HTTP 1.1 range access or on fallback case, it uses HTTP/1.0 sequential download anyway.

Source Code

The source code is available at GitHub.

NuGet Package

A prebuilt NuGet package is available: HttpStream.

To install HttpStream, run the following command in the Package Manager Console:

PM> Install-Package HttpStream

Supported Platforms

This module is built against .NET Platform Standard 1.6 (netstandard1.6) and it's compatible with the following platforms:

  • .NET Core 1.0
  • .NET Framework 4.6.1
  • Universal Windows Platform 10.0.16299
  • Mono 4.6
  • Xamarin.iOS 10.0
  • Xamarin.Mac 3.0
  • Xamarin.Android 7.0

For more information, see the illustration on Mapping the .NET Platform Standard to platforms - .NET Platform Standard.

Simple Usage

using Espresso3389.HttpStream;

// cache stream
var fs = File.Create("cache.jpg");

// The third parameter, true indicates that the httpStream will close the cache stream.
var uri = new Uri(@"https://dl.dropboxusercontent.com/u/150906/2007-01-28%2006.04.05.JPG");
var cacheSize = 1024 * 64;
var httpStream = new HttpStream.HttpStream(uri, fs, true, cacheSize, null);

// RangeDownloaded is called on every incremental download
httpStream.RangeDownloaded += (sender, e) =>
{
  Console.WriteLine("Progress: {0}%", (int)(100 * httpStream.CachedRatio));
};

// The following code actually invokes download whole the file
// You can use BufferedStream to improve I/O performance.
var bmp = await BitmapFactory.DecodeStreamAsync(new BufferedStream(httpStream, cacheSize));

License

The codes/binaries are licensed under MIT License.

This package has no dependencies.

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
2.0.50 485 10/28/2018
2.0.46 445 10/26/2018
2.0.43 445 10/17/2018
2.0.42 532 10/17/2018