C# download big file
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 > );
}
}
}
}
C# download big file的更多相关文章
- Unity3D发布WebPlayer时Failed to download data file解决方案
今天发布WebPlayer时, 发现直接打开html是可以正常运行的, 但是通过iis访问的话就会报错: Failed to download data file. 一开始以为是防火墙, 后来发现不是 ...
- How to download a file with plus symbol(+) filename in IIS?
How to download a file with plus symbol(+) filename in IIS? Original post link:https://www.cnblogs.c ...
- Unity 3D本地公布WebPlayer版时"Failed to download data file"解决方式
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGlzZW55YW5n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...
- Pikachu-File Inclusion, Unsafe file download & Unsafe file upload
Pikachu-File Inclusion, Unsafe file download & Unsafe file upload 文件包含漏洞 File Inclusion(文件包含漏洞)概 ...
- Download Excel file with Angular
源码连接(编写中) 用Angular下载后台返回的Excel文件,用Blob实现,引用FileSaver.js 后台C#代码: [WebMethod] public static byte[] Cal ...
- how to download a file with Nodejs(without using third-party libraries)用node下载文件
创建HTTP GET请求并将其管理response到可写文件流中: var http = require('http'); var fs = require('fs'); var file = fs. ...
- Unity 3D本地发布WebPlayer版时Failed to download data file解决方案
遇到这个问题就是指Web服务器并没有支持这种*.unity3d文件类型.需要做的是在Web服务器中添加MIME类型: IIS 7 及以上版本: 在功能视图的IIS选项卡中: 双击打开MIME,选择添加 ...
- R包安装失败failed to download mirrors file
在R console中使用install.packages()来安装第三方包时,会出现这样的错误: 即使我们选择的是China的镜像也解决不了问题. 这时候,可以先试试用IE打开上图中黑底部分的URL ...
- curl download zip file
https://askubuntu.com/questions/285976/download-zip-file-with-curl-command
随机推荐
- Mac-无法进入mysql,你这样做就对了
mysql -uroot -p 输入密码之后报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passwo ...
- CountDownLatch原理分析
CountDownLatch原理分析 CountDownLatch是一个同步工具类,它允许一个或多个线程一直等待,直到其他线程执行完后再执行.例如,应用程序的主线程希望在负责启动框架服务的线程已经启动 ...
- 利用Python进行数据分析-Pandas(第六部分-数据聚合与分组运算)
对数据集进行分组并对各组应用一个函数(无论是聚合还是转换),通常是数据分析工作中的重要环节.在将数据集加载.融合.准备好之后,通常是计算分组统计或生成透视表.pandas提供了一个灵活高效的group ...
- 使用opencv和numpy实现矩阵相乘和按元素相乘 matrix multiplication vs element-wise multiplication
本文首发于个人博客https://kezunlin.me/post/1e37a6/,欢迎阅读最新内容! opencv and numpy matrix multiplication vs elemen ...
- 【xmind】 使用 Java 生成思维导图
前言 在日常的工作与学习中,我们经常会使用思维导图这个工具,来把抽象而又无形的思考转换成有形并且具体的图像,是理清思路,梳理逻辑的一大神器. 准确的说,思维导图并不是一个具体的工具,而是一种方法.是道 ...
- Selenium(七):选择框(radio框、checkbox框、select框)
1. 选择框 本章使用的html代码: <!DOCTYPE html> <html lang="en"> <head> <meta cha ...
- 漫谈golang设计模式 简易工厂模式
目前学习golang的主要需求是为了看懂TiDB的源码,下面我们复习一下简易工厂模式的思想 工厂类型分为三种,创建型模式,结构型模式,行为型模式. 简单工厂 使用场景:考虑一个简单的API设计,一个模 ...
- 对cookie-parser的理解(签名、加密)
1.为什么说要利用签名防止cookie被恶意篡改 我们在浏览器输入用户名和密码发送post请求到后端服务器,后端服务器验证合法,返回响应,并Set-Cookie为sessionid=***;usern ...
- Android Gradle 学习笔记(三):Gradle 日志
在第一节,我们使用到了gradle -q hello命令行来运行Hello World,并对Hello World进行了简单的分析,了解到 gradle -q hello 的意思是要执行的build. ...
- Java后端,最全知识点
你可能有所感悟.零散的资料读了很多,但是很难有提升.到处是干货,但是并没什么用,简单来说就是缺乏系统化.另外,噪音太多,雷同的框架一大把,我不至于全都要去学了吧. 这里,根据基础.Java基础.Jav ...