You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+17-21Lines changed: 17 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,13 @@
6
6
7
7
## Overview 🔍
8
8
9
-
Light.TemporaryStreams is a lightweight .NET library that helps you convert non-seekable streams into seekable temporary
10
-
streams. A temporary stream is either backed by a memory stream (for input smaller than 80 KB) or a file stream to a
11
-
temporary file. This is particularly useful for backend services that receive streams from HTTP requests (e.g.,
12
-
`application/octet-stream`, custom-parsed `multipart/form-data`) or download files from storage systems for further
13
-
processing.
9
+
Light.TemporaryStreams is a lightweight .NET library that helps you convert non-seekable streams to seekable temporary streams. A temporary stream is either backed by a memory stream (for input smaller than 80 KB) or a file stream. This is particularly useful for backend services that receive streams from HTTP requests or download files from storage systems for further processing.
14
10
15
11
## Key Features ✨
16
12
17
13
- 🚀 Easy conversion of non-seekable streams to seekable temporary streams
18
14
- 💾 Automatic management of temporary files (creation and deletion)
19
-
- 🔄 Smart switching between memory-based and file-based streams based on size (similar behavior to ASP.NET Core's
20
-
`IFormFile`)
15
+
- 🔄 Smart switching between memory-based and file-based streams depending on size (similar behavior to ASP.NET Core's `IFormFile`)
21
16
- 🧩 Plugin system for extending functionality (e.g., calculating hashes during stream copying)
22
17
- 🔌 Integration with Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Logging
The `HashAlgorithm` instances passed to the `HashingPlugin` constructor in the previous example are actually converted into instances of `CopyToHashCalculator` via an implicit conversion operator. You can instantiate this class yourself to have more control over the conversion method that converts a hash byte array into a string as well as the name used to identify the hash calculator.
154
+
The `HashAlgorithm` instances passed to the `HashingPlugin` constructor in the previous example are actually converted to instances of `CopyToHashCalculator` via an implicit conversion operator. You can instantiate this class yourself to have more control over the conversion method that converts a hash byte array into a string as well as the name used to identify the hash calculator.
- Your service implements endpoints that receives `application/octet-stream` that you need to process further.
176
-
- Your service implements endpoints that receives `multipart/form-data` and you cannot use `IFormFile`, for example because the request has both JSON and binary data. See [this blog post by Andrew Lock](https://andrewlock.net/reading-json-and-binary-data-from-multipart-form-data-sections-in-aspnetcore/) for an example.
177
-
- Your service downloads files from storage systems like S3 and processes them further.
170
+
- Your service implements endpoints that receive `application/octet-stream` requests and you need to process the incoming stream in a seekable way.
171
+
- Your service implements endpoints that receive `multipart/form-data` requests and you cannot use `IFormFile`, for example because the request has both JSON and binary data. See [this blog post by Andrew Lock](https://andrewlock.net/reading-json-and-binary-data-from-multipart-form-data-sections-in-aspnetcore/) for an example.
172
+
- Your service downloads files from storage systems like Amazon S3 or Azure Storage Accounts and processes them further.
173
+
- Your endpoint wants to return a stream to the caller and the file should be gone after the request finishes.
178
174
179
175
## Light.TemporaryStreams.Core vs. Light.TemporaryStreams 🧰
180
176
@@ -198,11 +194,11 @@ This package builds on Core and adds integration with:
198
194
199
195
Use Light.TemporaryStreams.Core if you're working in a non-DI environment or have your own DI container.
200
196
Use Light.TemporaryStreams if you're working in an ASP.NET Core application or any other application supporting
201
-
Microsoft.Extensions.DependencyInjection.
197
+
Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Logging.
202
198
203
199
## Contributing 🤝
204
200
205
-
Contributions are welcome! First, create an issue to discuss your idea. After that, you can submit pull requests.
201
+
Contributions are welcome! First, create an issue to discuss your idea. After that, you can submit a pull request.
0 commit comments