OssObject读取文件的大小有限制?
ReOssObject读取文件的大小有限制?
obj.Content类型是网络流,一次读的字节数不定,需要循环调用read函数
using (var requestStream = o.Content)
{
byte[] buf = new byte[1024];
var fs = File.Open(fileToDownload, FileMode.OpenOrCreate);
var len = 0;
while ((len = requestStream.Read(buf, 0, 1024)) != 0)
{
fs.Write(buf, 0, len);
}
fs.Close();
Console.WriteLine('GetObject done.');
}
赞0
踩0