mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 17:01:08 +00:00

Adds the ability to for write streams to have an _final method which acts similarly to the _flush method that transform streams have but is called before the finish event is emitted and if asynchronous delays the stream from finishing. The `final` option may also be passed in order to set it. PR-URL: https://github.com/nodejs/node/pull/12828 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
12 lines
225 B
JavaScript
12 lines
225 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
const Readable = require('stream').Readable;
|
|
|
|
const _read = common.mustCall(function _read(n) {
|
|
this.push(null);
|
|
});
|
|
|
|
const r = new Readable({ read: _read });
|
|
r.resume();
|