GenHTTP.Modules.IO
10.1.0
See the version list below for details.
dotnet add package GenHTTP.Modules.IO --version 10.1.0
NuGet\Install-Package GenHTTP.Modules.IO -Version 10.1.0
<PackageReference Include="GenHTTP.Modules.IO" Version="10.1.0" />
<PackageVersion Include="GenHTTP.Modules.IO" Version="10.1.0" />
<PackageReference Include="GenHTTP.Modules.IO" />
paket add GenHTTP.Modules.IO --version 10.1.0
#r "nuget: GenHTTP.Modules.IO, 10.1.0"
#:package GenHTTP.Modules.IO@10.1.0
#addin nuget:?package=GenHTTP.Modules.IO&version=10.1.0
#tool nuget:?package=GenHTTP.Modules.IO&version=10.1.0
GenHTTP.Modules.IO
Provides I/O related functionality to be used within a GenHTTP application.
Resources
Access to resources such as files are abstracted in GenHTTP via IResourceTree
and IResource. The I/O module adds common implementations to load resources from
strings, files or an assembly. It also adds useful features such as virtual resource
trees or change tracking for resources.
See the documentation for more details.
Content Implementations
Besides the resource implementations, the module adds some IResponseContent
implementations that can be used to directly set the content when building a response.
See the documentation for more details.
Providers
The following handlers and concerns are provided by this module.
Handlers / Concerns
Those entry points allow to quickly create concerns and handlers without the need of implementing interfaces and of providing builders.
For documentation, see the concern and handler pages.
Content
Provides a single resource to a requesting client. In contrast to downloads,
the response is expected to be consumed by the client without actually downloading it
to a local file. The Content-Type is computed from the given resource. For named
resources, the logic will try to guess the content type from the file extension.
using GenHTTP.Engine.Internal;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Practices;
var content = Content.From(Resource.FromString("Hello World!"));
var app = Layout.Create()
.Add("hello", content);
await Host.Create()
.Handler(app)
.Defaults()
.Console()
.RunAsync();
The module also provides extensions
Downloads
Allows clients to download a single resource and to specify the name as
it should be presented to the user. The logic tries to automatically
determine the Content-Type of the resource.
using GenHTTP.Api.Protocol;
using GenHTTP.Engine.Internal;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Practices;
var file = Resource.FromFile("./my.pdf");
var download = Download.From(file)
.FileName("invoice-user-1234.pdf") // optional, would be "my.pdf" otherwise
.Type(ContentType.ApplicationPdf); // optional, automatically detected here
var app = Layout.Create()
.Add("get-invoice", download);
await Host.Create()
.Handler(app)
.Defaults()
.Console()
.RunAsync();
Range Support
This concern allows clients to request only a specific part of the data provided by the inner handler.
For this to work, the inner handler needs to set a Content-Length on the response. Chunked responses
are not supported. Requires the HTTP method to be GET or HEAD.
The concern will set a Accept-Ranges: bytes header to signal range support to the client.
The client can then request a specific byte range using the Range header, e.g. Range: 100- to skip
the first 100 bytes of the response.
While this concern can safely be applied to the root handler, it is recommended to apply it only to the handlers where the functionality is needed, as there is some runtime overhead for each request.
using GenHTTP.Engine.Internal;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Practices;
var download = Download.From(Resource.FromFile("my-large.bin"))
.AddRangeSupport();
var app = Layout.Create()
.Add("file", download);
await Host.Create()
.Handler(app)
.Defaults()
.Console()
.RunAsync();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- GenHTTP.Api (>= 10.1.0)
-
net8.0
- GenHTTP.Api (>= 10.1.0)
-
net9.0
- GenHTTP.Api (>= 10.1.0)
NuGet packages (36)
Showing the top 5 NuGet packages that depend on GenHTTP.Modules.IO:
| Package | Downloads |
|---|---|
|
GenHTTP.Core
Basic dependencies for projects using the GenHTTP framework, including the engine itself |
|
|
GenHTTP.Modules.Pages
Allows to generate and serve HTML pages |
|
|
GenHTTP.Modules.Conversion
Allows to read and write responses in additional data formats such as JSON or XML |
|
|
GenHTTP.Modules.Practices
Best practices to configure a GenHTTP webserver instance for production |
|
|
GenHTTP.Modules.Webservices
Module to add REST-based webservices to a GenHTTP project. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.4.0 | 1,014 | 12/30/2025 |
| 10.3.0 | 1,667 | 12/19/2025 |
| 10.2.0 | 1,131 | 12/11/2025 |
| 10.1.2 | 1,041 | 12/10/2025 |
| 10.1.1 | 913 | 11/28/2025 |
| 10.1.0 | 1,289 | 11/20/2025 |
| 10.0.0 | 1,972 | 11/11/2025 |
| 9.8.0 | 2,477 | 7/9/2025 |
| 9.7.0 | 1,924 | 2/27/2025 |
| 9.6.2 | 2,415 | 1/31/2025 |
| 9.6.1 | 251 | 1/31/2025 |
| 9.6.0 | 1,028 | 1/22/2025 |
| 9.5.0 | 606 | 1/10/2025 |
| 9.4.0 | 722 | 12/20/2024 |
| 9.3.0 | 578 | 12/11/2024 |
| 9.2.0 | 728 | 11/29/2024 |
| 9.1.0 | 1,176 | 11/22/2024 |
| 9.0.0 | 880 | 11/13/2024 |
| 8.6.0 | 2,569 | 7/1/2024 |
| 8.5.0 | 1,727 | 6/4/2024 |
| 8.4.0 | 1,021 | 5/28/2024 |
| 8.3.0 | 1,859 | 4/23/2024 |
| 8.2.0 | 1,853 | 3/12/2024 |
| 8.1.1 | 1,097 | 2/26/2024 |
| 8.1.0 | 1,494 | 1/4/2024 |
| 8.0.0 | 1,995 | 11/23/2023 |
| 7.0.0 | 1,973 | 7/3/2023 |
| 6.4.0 | 10,220 | 8/23/2022 |
| 6.3.5 | 4,187 | 7/1/2022 |
| 6.3.4 | 3,422 | 4/26/2022 |
| 6.3.3 | 3,153 | 2/21/2022 |
| 6.3.2 | 3,070 | 1/24/2022 |
| 6.3.1 | 2,161 | 12/21/2021 |
| 6.3.0 | 2,117 | 12/20/2021 |
| 6.2.0 | 2,570 | 12/3/2021 |
| 6.1.0 | 7,687 | 11/24/2021 |
| 6.0.0 | 2,122 | 11/9/2021 |
| 5.2.3 | 708 | 7/9/2021 |
| 5.2.0 | 3,538 | 1/18/2021 |
| 5.1.0 | 2,932 | 12/13/2020 |
| 5.0.0 | 2,358 | 11/20/2020 |
| 4.1.0 | 2,831 | 10/22/2020 |
| 4.0.0 | 2,900 | 10/5/2020 |