下载远程的文件读取到字节
作者:互联网
/// <summary>
/// 下载远程的文件读取到字节
/// </summary>
/// <param name="uRLAddress">文件地址</param>
/// <returns></returns>
public static byte[] DownFile(string uRLAddress)
{
WebClient client = new WebClient();
byte[] mbyte = null;
Stream str = client.OpenRead(uRLAddress);
StreamReader reader = new StreamReader(str);
using (MemoryStream ms = new MemoryStream())
{
reader.BaseStream.CopyTo(ms);
mbyte = ms.ToArray();
}
reader.Close();
str.Close();
return mbyte;
}
标签:mbyte,字节,str,ms,reader,new,远程,MemoryStream,读取 来源: https://www.cnblogs.com/wugh8726254/p/15340153.html