文件流处理

xiaoxiao2021-02-27  259

1、文件流写入本地

                            //Stream stream = res.Content.ReadAsStreamAsync().Result;                             //FileStream fs = File.Create("D:\\1.text");                             //stream.CopyTo(fs);                             //fs.Flush();                             //fs.Close();

2、文件流转为tobase64str

                            byte[] bt = new byte[stream.Length];                             //调用read读取方法                               stream.Read(bt, 0, bt.Length);                             string base64Str = Convert.ToBase64String(bt);                             stream.Close();

转载请注明原文地址: https://www.6miu.com/read-6055.html

最新回复(0)