title: Dotnet core: send byte array as file from web api without saving it to disk
body: <p>I have a web api that need to let the user download/inline a binary file I have saved to a database.</p>
  
  <p>So far now I could achieve it like this:</p>
  
  <pre><code>string ContentType = (string) (result["content_type"] ?? "");
  string FileName = (string) (result["file_name"] ?? "");
  byte[] content = (byte[]) result["data"];
  
  Stream stream = new MemoryStream(content);
  var fullFileName = Path.GetTempFileName();
  File.WriteAllBytes(fullFileName, content);
  
  _res.ContentType = ContentType;
  _res.StatusCode = (int)HttpStatusCode.OK;
  _res.Headers.Add("Content-Disposition", $"{Disposition}; filename=\"{FileName}\"");
  await _res.SendFileAsync(fullFileName);
  </code></pre>
  
  <p>I'd like to know how could I send directly the memory stream to the response, in order to avoid saving the file to disk.</p>