The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
36 lines
709 B
JavaScript
36 lines
709 B
JavaScript
var common = require('../common.js');
|
|
var R = require('_stream_readable');
|
|
var W = require('_stream_writable');
|
|
var assert = require('assert');
|
|
|
|
var src = new R({encoding: 'base64'});
|
|
var dst = new W();
|
|
var hasRead = false;
|
|
var accum = [];
|
|
var timeout;
|
|
|
|
src._read = function(n) {
|
|
if(!hasRead) {
|
|
hasRead = true;
|
|
process.nextTick(function() {
|
|
src.push(new Buffer('1'));
|
|
src.push(null);
|
|
});
|
|
};
|
|
};
|
|
|
|
dst._write = function(chunk, enc, cb) {
|
|
accum.push(chunk);
|
|
cb();
|
|
};
|
|
|
|
src.on('end', function() {
|
|
assert.equal(Buffer.concat(accum) + '', 'MQ==');
|
|
clearTimeout(timeout);
|
|
})
|
|
|
|
src.pipe(dst);
|
|
|
|
timeout = setTimeout(function() {
|
|
assert.fail('timed out waiting for _write');
|
|
}, 100);
|