可复用Stream 需要安装 Microsoft.IO.RecyclableMemoryStream。 internal class StreamHandler { // Stream pool private static readonly Rec[......]继续阅读

2022年10月18日 0条评论 1752点热度 0人点赞 痴者工良 阅读全文

ASP.NET Core Response.Body 默认是 HttpResponseStream,其主要特征是只能追加写,不能读取也不能修改。 所以最根本方法是替换 HttpResponseStream。 随便设置一个中间件,或者将 HttpContext 拿出来,定义变量 context。 替[......] 继续阅读

2022年9月30日 0条评论 1626点热度 0人点赞 痴者工良 阅读全文

处理 Stream 的一些用法。 public static byte[] GetAllBytes(this Stream stream) { using (var memoryStream = new MemoryStream()) {[......]继续阅读

2022年6月24日 0条评论 1312点热度 0人点赞 痴者工良 阅读全文