Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Explit throw on deprecated Buffer.write(...)
  • Loading branch information
dcposch committed Feb 4, 2016
commit 2c53436e5aaa4e0da72ab63c3c8a0feec65c22a7
5 changes: 4 additions & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ Buffer.prototype.write = function(string, offset, length, encoding) {
offset = 0;

// Buffer#write(string, offset[, length][, encoding])
} else {
} else if (isFinite(offset)) {
offset = offset >>> 0;
if (isFinite(length)) {
length = length >>> 0;
Expand All @@ -557,6 +557,9 @@ Buffer.prototype.write = function(string, offset, length, encoding) {
encoding = length;
length = undefined;
}
} else {
throw new Error('Buffer.write(string, encoding, offset[, length]) ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically should be ``Buffer.write(string, encoding[, offset[, length]])'`, but I really don't care whether it's changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string, encoding fits into the current signature, so it's not deprecated. I made that mistake in the first grep :-).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChALkeR Sorry, not following.

'is no longer supported');
}

var remaining = this.length - offset;
Expand Down