Open Shane88 opened 10 months ago
@Shane88 thank you for your interest in Sep and the detailed issue description. You are right that Sep does not support async usage currently and there are currently no immediate plans to support. However, I do hope to add it at some point, so I will leave this issue open to track it.
Just to be sure people are aware of this, you can of course copy the stream to a MemoryStream
via await stream.CopyToAsync(memoryStream)
. This of course isn't particularly efficient but at least you can do that.
When trying to use
Sep.Reader().From(stream)
with a stream returned fromIBrowserFile.OpenReadStream
in the context of a user's browser in a .NET Blazor WASM application, it fails becauseSynchronous reads are not supported.
To my understanding there is no other methods that can be used for Sep to use an asynchronous read from the supplied stream.The stack trace will look like the following inside Blazor WASM:
Note that BrowserFileStream belongs to AspNetCore.Components so I suspect this might also happen other frameworks like MVC but I haven't tested. The msdoc link for the method returning the async only stream is here (IBrowserFile.OpenReadStream(Int64, CancellationToken) Method)
Having had a good look over Seps docs I understand that async stream compatibility might be tricky and out of scope for the intended use of Sep. If that is the conclusion, it would be appreciated to update Sep docs to mention that.
Thinking about what async support might look like with Sep, I thought of the following.
Cheers.