blob: fb489978f498ad1fb7fef1737bada2a160a6ae55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
'use strict';
require('../common');
var stream = require('stream');
var Buffer = require('buffer').Buffer;
var r = new stream.Readable();
r._read = function(size) {
r.push(Buffer.allocUnsafe(size));
};
var w = new stream.Writable();
w._write = function(data, encoding, cb) {
cb(null);
};
r.pipe(w);
// This might sound unrealistic, but it happens in net.js. When
// `socket.allowHalfOpen === false`, EOF will cause `.destroySoon()` call which
// ends the writable side of net.Socket.
w.end();
|