Skip to content

Commit ec9ff95

Browse files
save file
1 parent a118b93 commit ec9ff95

File tree

1 file changed

+27
-0
lines changed
  • blog/25-07-25/http-streaming-download/ex

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
3+
require('http').createServer(request).listen(3000);
4+
console.log('http://localhost:3000');
5+
6+
7+
function request(req,res){
8+
9+
var c = 0;
10+
fn();
11+
12+
13+
function fn(){
14+
15+
res.write('hello '+c);
16+
c++;
17+
if(c<5){
18+
setTimeout(fn,500);
19+
return;
20+
}
21+
res.end();
22+
23+
}//fn
24+
25+
}//request
26+
27+

0 commit comments

Comments
 (0)