0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-stream-write-drain.js
Robert Nagy 605d7c4d6a stream: do not emit drain if stream ended
PR-URL: https://github.com/nodejs/node/pull/29086
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-08-20 08:55:36 -07:00

17 lines
291 B
JavaScript

'use strict';
const common = require('../common');
const { Writable } = require('stream');
// Don't emit 'drain' if ended
const w = new Writable({
write(data, enc, cb) {
process.nextTick(cb);
},
highWaterMark: 1
});
w.on('drain', common.mustNotCall());
w.write('asd');
w.end();