mirror of https://github.com/lukechilds/node.git
Browse Source
Add a `data` argument on Transform._flush() callback to be API consistent with Transform._transform(). Fixes: https://github.com/nodejs/node/issues/3707 PR-URL: https://github.com/nodejs/node/pull/3708 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>v7.x
committed by
Matteo Collina
3 changed files with 34 additions and 4 deletions
@ -0,0 +1,27 @@ |
|||
'use strict'; |
|||
|
|||
require('../common'); |
|||
|
|||
const assert = require('assert'); |
|||
const Transform = require('stream').Transform; |
|||
|
|||
|
|||
const expected = 'asdf'; |
|||
|
|||
|
|||
function _transform(d, e, n) { |
|||
n(); |
|||
} |
|||
function _flush(n) { |
|||
n(null, expected); |
|||
} |
|||
|
|||
var t = new Transform({ |
|||
transform: _transform, |
|||
flush: _flush |
|||
}); |
|||
|
|||
t.end(Buffer.from('blerg')); |
|||
t.on('data', (data) => { |
|||
assert.strictEqual(data.toString(), expected); |
|||
}); |
Loading…
Reference in new issue