C# download big file
2024-09-06 08:46:19
I had validated this.To download SSMS which is more than 500M+
static void Main(string[] args)
{
string url = "https://go.microsoft.com/fwlink/?linkid=2108895&clcid=0x409";
DownloadBigFile(new Uri(url), "ssms.exe");
} static void DownloadBigFile(Uri url, string outputFilePath)
{
const int BUFFER_SIZE = * ;
using (var outputFileStream = File.Create(outputFilePath, BUFFER_SIZE))
{
var req = WebRequest.Create(url);
using (var response = req.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
var buffer = new byte[BUFFER_SIZE];
int bytesRead;
do
{
bytesRead = responseStream.Read(buffer, , BUFFER_SIZE);
outputFileStream.Write(buffer, , bytesRead);
} while (bytesRead > );
}
}
}
}
最新文章
- linux多文本替换内容
- 使用Dhcpstarv解决DHCP服务器冲突问题
- java解惑 读书笔记
- zabbix 二 zabbix agent 客户端
- php随机抽奖
- Sphinx安装流程及配合PHP使用经验
- window10单机安装storm集群
- 简单的将Excel数据同步到SqlServer数据库中
- 把axios封装为vue插件使用
- COM中参数标识
- 【Mybatis】【2】处理大于号小于号及其他特殊字符
- CentOS7双网卡绑定配置
- win 10 安装visual studio 2010
- [转]IOS 崩溃日志分析
- HttpClient post封装
- 初识storm
- 初探APT 攻击
- Qt中容器类应该如何存储对象
- CRC全套~~~ 转载
- Shadow Map 原理和改进 【转】