Skip to content

Commit ae4cc27

Browse files
committed
close事件例子
1 parent cbdf78b commit ae4cc27

File tree

1 file changed

+14
-0
lines changed
  • examples/2017.05.23-node-stream-readable/event

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var fs = require('fs');
2+
var readstream = fs.createReadStream('./hello.txt');
3+
4+
readstream.on('data', function (chunk) {
5+
console.log('on data: %s', chunk);
6+
});
7+
8+
readstream.on('close', function () {
9+
console.log('on close');
10+
});
11+
12+
// 输出
13+
// on data: hello world
14+
// on close

0 commit comments

Comments
 (0)