uHttpSharp
uHttpSharp copied to clipboard
Locked files after download
I have a problem were once files are downloaded (e.g using the FileHandler) the files remain locked because the ContentStream of the HttpResponse is never closed/disposed. Is there a way around this? I feel the file should be released once the transfer is complete.
Hi @ficiyoki, this repository is no longer maintained, you're welcome to create a pull request and I'll merge it if everything looks good.
Just close the stream after the content is written.
public async Task WriteBody(StreamWriter writer) {
ContentStream.Position = 0;
await writer.FlushAsync().ConfigureAwait(false);
await ContentStream.CopyToAsync(writer.BaseStream).ConfigureAwait(false);
//close the stream
--> ContentStream.Close(); }