Skip to content

Commit 9b8a411

Browse files
save file
1 parent a189a1d commit 9b8a411

File tree

1 file changed

+6
-3
lines changed
  • blog/25-07-25/http-streaming-download/ex

1 file changed

+6
-3
lines changed

blog/25-07-25/http-streaming-download/ex/server.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@
66

77
function stream(req,res){
88
console.log(req.url);
9-
var c = 1;
9+
var c = 1;
10+
var max = 20;
11+
var delay = 1000;
12+
1013
fn();
1114

1215

1316
function fn(){
1417
console.log('stream',c);
1518
res.write('hello '+c);
16-
if(c==5){
19+
if(c==max){
1720
res.end();
1821
return;
1922
}
2023
c++;
21-
setTimeout(fn,500);
24+
setTimeout(fn,delay);
2225

2326
}//fn
2427

0 commit comments

Comments
 (0)