-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: 'data' argument on callback of Transform._flush()
Add a `data` argument on Transform._flush() callback to be API consistent with Transform._transform(). Fixes: #3707 PR-URL: #3708 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |