I'm trying to download a file using IDownstreamApi I've tried the following code
var file = await downstreamApi.GetForAppAsync<Stream>(Definitions.FileshareApi, options =>
{
options.RelativePath = $"{ApiPaths.FileDownload}{sourceUri}";
}, cancellationToken: cancellationToken);
if(file != null)
{
var target = new FileStream(targetFilePath, FileMode.Create);
file.CopyTo(target);
return true;
}
but I get the following exception
System.Text.Json.JsonException: 'The JSON value could not be converted to System.IO.Stream. Path: $ | LineNumber: 0 |
Is it possible to download a file using the IDownstreamApi. If how do you use it to do this.