-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: return contentresult with stream and filename for content download
- Loading branch information
Showing
4 changed files
with
75 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
namespace Sinch.Core | ||
{ | ||
public sealed class ContentResult : IDisposable, IAsyncDisposable | ||
{ | ||
/// <summary> | ||
/// The Stream containing data of the file | ||
/// </summary> | ||
public Stream Stream { get; init; } = null!; | ||
|
||
/// <summary> | ||
/// Name of the file, if available. | ||
/// </summary> | ||
public string? FileName { get; init; } | ||
|
||
public void Dispose() | ||
{ | ||
Stream.Dispose(); | ||
} | ||
|
||
public async ValueTask DisposeAsync() | ||
{ | ||
await Stream.DisposeAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters