File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /* This is an example stressing the Chunked transfer mode */
2+ /* It is not the most optimal way to send lots of data, tryEnd is */
3+ /* If you do not know the size of the file, this Chunked transfer mode
4+ * is necessary. We send 256kb chunks and wait for them to drain. The
5+ * max backpressure is thus 256 kb. Again, tryEnd is more efficient if
6+ * you know the file size. The call "end" with a huge file is the worst
7+ * possible way, as it copies the entire file to backpressure. */
8+
19const uWS = require ( 'uWebSockets.js' ) ;
210const fs = require ( 'fs' ) ;
311
@@ -17,7 +25,6 @@ function getFileView(name) {
1725const videoView = getFileView ( fileName ) ;
1826const totalSize = videoView . byteLength ;
1927
20- console . log ( 'WARNING: NEVER DO LIKE THIS; WILL CAUSE HORRIBLE BACKPRESSURE!' ) ;
2128console . log ( 'Video size is: ' + totalSize + ' bytes' ) ;
2229
2330const CHUNK_SIZE = 1024 * 256 ;
You can’t perform that action at this time.
0 commit comments