tmenier / Flurl

Fluent URL builder and testable HTTP client for .NET

Home Page:https://flurl.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I speed limit when upload file

handloong opened this issue · comments

Flurl.Http : 4.0.2
Flurl : 4.0.2

I'm writing a utility that will be uploading files, and would like to provide the option to rate limit uploads. like max speed : 10M/s
Has anyone implemented something like this before?

private async void button1_Click(object sender, EventArgs e)
{

	var speed = 1024 * 1024;// 1M/s

	var fileStream = new FileStream(@"Large File", FileMode.Open);
	var response = await @"http://xxxxx:8000/upload"
		.PostMultipartAsync(content => content
		.AddFile("file", fileStream, "myfile.ios"))
		.ReceiveString();

	MessageBox.Show(response);
}

Sounds like a programming question, I prefer people use Stack Overflow for that - more visibility and better odds of getting a good answer. I'd even start by searching on it, and frame it as an HttpClient question. I don't actually know the answer, never done anything like that.