Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/_stream_writable.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -541,7 +541,7 @@ function clearBuffer(stream, state){
}

Writable.prototype._write = function(chunk, encoding, cb){
cb(new errors.Error('ERR_METHOD_NOT_IMPLEMENTED', '_transform'));
cb(new errors.Error('ERR_METHOD_NOT_IMPLEMENTED', '_write'));
};

Writable.prototype._writev = null;
Expand Down
12 changes: 11 additions & 1 deletion test/parallel/test-stream-writable-constructor-set-methods.js
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
'use strict';
require('../common');
constcommon=require('../common');
constassert=require('assert');

constWritable=require('stream').Writable;
Expand All@@ -26,6 +26,16 @@ w2.write(Buffer.from('blerg'));
w2.write(Buffer.from('blerg'));
w2.end();

constw3=newWritable();

w3.on('error',common.expectsError({
type: Error,
code: 'ERR_METHOD_NOT_IMPLEMENTED',
message: 'The _write method is not implemented'
}));

w3.end(Buffer.from('blerg'));

process.on('exit',function(){
assert.strictEqual(w._write,_write);
assert(_writeCalled);
Expand Down