Skip to content

Throttle (pause/resume) file upload #1043

Closed Pinned Answered by uNetworkingAB
pixelzor asked this question in Q&A
Discussion options

You must be logged in to vote

You can pause receiving with https://unetworking.github.io/uWebSockets.js/generated/interfaces/HttpResponse.html#pause.pause-1

But you need to buffer up spurious data either way (up to 512kb but for correctness you need to handle all spurious data). So call onData first, then call pause and when you have your filename call resume then write first your buffered up then from onData.

This library does not hide or fake behavior that would be non-technical so for this reason there still is spurious data like mentioned above (it's impossible to know, efficiently)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@pavulon
Comment options

@uNetworkingAB
Comment options

Answer selected by uNetworkingAB
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants