mirror of https://github.com/nodejs/node.git
22 lines
501 B
JavaScript
22 lines
501 B
JavaScript
'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();
|