Float.FileDownloader 1.0.0.44

dotnet add package Float.FileDownloader --version 1.0.0.44
NuGet\Install-Package Float.FileDownloader -Version 1.0.0.44
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="Float.FileDownloader" Version="1.0.0.44" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Float.FileDownloader --version 1.0.0.44
#r "nuget: Float.FileDownloader, 1.0.0.44"
#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 Float.FileDownloader as a Cake Addin
#addin nuget:?package=Float.FileDownloader&version=1.0.0.44

// Install Float.FileDownloader as a Cake Tool
#tool nuget:?package=Float.FileDownloader&version=1.0.0.44

Float.FileDownloader Test NuGet

This Xamarin library provides a convenient API for downloading HTTP responses to a file. Additionally, it provides a barebones concept of a "remote file" (e.g. a PDF or ZIP file on a server) and provides the logic necessary for downloading and caching the file locally.

Building

This project can be built using Visual Studio for Mac or Cake. It is recommended that you build this project by invoking the bootstrap script:

./build.sh

There are a number of optional arguments that can be provided to the bootstrapper that will be parsed and passed on to Cake itself. See the Cake build file in order to identify all supported parameters.

./build.sh \
    --task=Build \
    --projectName=Float.FileDownloader \
    --configuration=Debug \
    --nugetUrl=https://nuget.org \
    --nugetToken=####

Installing

NuGet

This library is available as a NuGet via nuget.org.

Testing

Note that xUnit reporting with Visual Studio can be a bit wonky, but it will run the tests. Whether or not they show in VS is seemingly random. For best results, run the tests from the command line as follows.

dotnet test Float.FileDownloader.Tests/Float.FileDownloader.Tests.csproj

To get test reports in Nunit format:

dotnet test Float.FileDownloader.Tests/Float.FileDownloader.Tests.csproj -l nunit

Test report should be published at Float.FileDownloader.Tests/TestResults/TestResults.xml.

Usage

Downloading HTTP response to file

At it's core, this library is simply for downloading an HTTP response to a file.

using Float.FileDownloader;
...
var request = new HttpRequestMessage(HttpMethod.Get, "http://example.com/file.pdf");
var response = await DownloadRequest.Download(request, "/absolute/path/to/file.pdf");
// The file is download available at `/absolute/path/to/file.pdf`

Downloading files

However, if you're downloading remote files (such as PDF or ZIP files), you may find it useful to use the FileDownloadRequest abstraction.

In your model layer, the model that represents a file should implement IRemoteFile. Additionally, your application must implement an IRemoteFileProvider to prepare an HttpRequestMessage (with a URL, authentication, caching headers, etc.).

Then, you can download the file like so:

using Float.FileDownloader;
...
var fileProvider = /* the `IFileProvider` */;
var file = /* file model */;

// Must be an absolute Uri to a local spot on disk
var downloadDestination = new Uri("/path/to/file.pdf");

// Optionally, you may receive updates about the status of the download
var status = new DownloadStatus("My Download");

var response = await FileDownloadRequest.DownloadFile(fileProvider, file, downloadDestination, status);

Processing files

Additionally, you may want to process or manipulate the downloaded data before making it available to your application. This could include unzipping a zip file, resizing an image, etc.

Implement the IRemoteFileProcessor interface to manipulate the downloaded data before your application is notified of the finished download.

License

All content in this repository is shared under an MIT license. See license.md for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Float.FileDownloader:

Package Downloads
Float.TinCan.ActivityLibrary

A library for starting xAPI activities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.44 188 7/28/2023
1.0.0.43 136 7/21/2023
1.0.0.42 118 7/21/2023
1.0.0.41 123 7/20/2023
1.0.0.40 134 7/6/2023
1.0.0.5 2,271 1/24/2022
1.0.0 993 12/16/2021