简体   繁体   English

使使用流的RESTful端点

[英]Make RESTful Endpoint that uses Streams

I have an ASP.NET Core (RC2) WebApi project, and for one of the APIs, I need to take in a zip file, ideally as a Stream, and then return another zip file, again ideally as a stream. 我有一个ASP.NET Core(RC2)WebApi项目,对于其中一个API,我需要输入一个zip文件(理想情况下作为Stream),然后返回另一个zip文件(理想情况下作为流)。 Is this possible? 这可能吗?

Right now my web api gets and returns a base 64 encoded string... I feel using Streams would be much more efficient. 现在,我的Web API获取并返回一个以64为底的编码字符串。我觉得使用Streams会更加高效。

This answer shows how to access the HTTP stream from within a Controller. 此答案显示了如何从Controller内部访问HTTP流。 You could probably adapt it. 您可能会适应它。 Writing to Output Stream from Action 从动作写入输出流

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM