Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: Remove pump #2531

Closed
wants to merge 1 commit into from
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
8 changes: 1 addition & 7 deletions doc/api/util.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Returns `true` if the given "object" is a `Boolean`. `false` otherwise.
// false
util.isBoolean(false)
// true

## util.isBuffer(object)

Stability: 0 - Deprecated
Expand Down Expand Up @@ -493,12 +493,6 @@ Output with timestamp on `stdout`.

Deprecated predecessor of `console.log`.

## util.pump(readableStream, writableStream[, callback])

Stability: 0 - Deprecated: Use readableStream.pipe(writableStream)

Deprecated predecessor of `stream.pipe()`.

## util.puts([...])

Stability: 0 - Deprecated: Use console.log() instead.
Expand Down
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ function filteredOwnPropertyNames(obj) {
//
// Example:
// complete('var foo = util.')
// -> [['util.print', 'util.debug', 'util.log', 'util.inspect', 'util.pump'],
// -> [['util.print', 'util.debug', 'util.log', 'util.inspect'],
// 'util.' ]
//
// Warning: This eval's code like "foo.bar.baz", so it will run property
Expand Down
38 changes: 0 additions & 38 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,44 +864,6 @@ exports.error = internalUtil.deprecate(function(x) {
}, 'util.error is deprecated. Use console.error instead.');


exports.pump = internalUtil.deprecate(function(readStream, writeStream, cb) {
var callbackCalled = false;

function call(a, b, c) {
if (cb && !callbackCalled) {
cb(a, b, c);
callbackCalled = true;
}
}

readStream.addListener('data', function(chunk) {
if (writeStream.write(chunk) === false) readStream.pause();
});

writeStream.addListener('drain', function() {
readStream.resume();
});

readStream.addListener('end', function() {
writeStream.end();
});

readStream.addListener('close', function() {
call();
});

readStream.addListener('error', function(err) {
writeStream.end();
call(err);
});

writeStream.addListener('error', function(err) {
readStream.destroy();
call(err);
});
}, 'util.pump is deprecated. Use readableStream.pipe instead.');


exports._errnoException = function(err, syscall, original) {
var errname = uv.errname(err);
var message = syscall + ' ' + errname;
Expand Down