使用c#和typescript从客户端下载文件,而不将其存储在服务器中
我在应用程序中使用c#和typescript。我的数据库中有一个XML列,需要将其作为文件填充到客户端。我尝试将它作为文件存储在我的服务器上,然后下载,当它工作时,我不想在服务器上存储任何东西使用c#和typescript从客户端下载文件,而不将其存储在服务器中,c#,.net,typescript,.net-core,C#,.net,Typescript,.net Core,我在应用程序中使用c#和typescript。我的数据库中有一个XML列,需要将其作为文件填充到客户端。我尝试将它作为文件存储在我的服务器上,然后下载,当它工作时,我不想在服务器上存储任何东西 string zipPath = $"{path}.zip"; if (System.IO.File.Exists(zipPath)) { System.IO.File.Delete(zipPath); } ZipFile.CreateFromDirectory(path,
string zipPath = $"{path}.zip";
if (System.IO.File.Exists(zipPath))
{
System.IO.File.Delete(zipPath);
}
ZipFile.CreateFromDirectory(path, zipPath);
MemoryStream memory = new MemoryStream();
using (FileStream stream = new FileStream(zipPath, FileMode.Open))
{
await stream.CopyToAsync(memory);
}
memory.Position = 0;
fileStreamResult = File(memory, "application/zip", Path.GetFileName(zipPath));
这是我用来从服务器“下载”文件的代码。我想单独使用数据库和客户端,我不想在服务器上存储任何东西。请帮忙