mirror of https://github.com/nodejs/node.git
buffer.copy targetStart defaults to 0
parent
6d7242b485
commit
aed0ba3211
|
@ -113,7 +113,7 @@ buffer object. It does not change when the contents of the buffer are changed.
|
||||||
// 1234
|
// 1234
|
||||||
// 1234
|
// 1234
|
||||||
|
|
||||||
### buffer.copy(targetBuffer, targetStart, sourceStart=0, sourceEnd=buffer.length)
|
### buffer.copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
||||||
|
|
||||||
Does a memcpy() between buffers.
|
Does a memcpy() between buffers.
|
||||||
|
|
||||||
|
|
|
@ -280,11 +280,12 @@ Buffer.prototype.toString = function (encoding, start, end) {
|
||||||
Buffer.byteLength = SlowBuffer.byteLength;
|
Buffer.byteLength = SlowBuffer.byteLength;
|
||||||
|
|
||||||
|
|
||||||
// copy(targetBuffer, targetStart, sourceStart=0, sourceEnd=buffer.length)
|
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
||||||
Buffer.prototype.copy = function copy (target, target_start, start, end) {
|
Buffer.prototype.copy = function copy (target, target_start, start, end) {
|
||||||
var source = this;
|
var source = this;
|
||||||
start || (start = 0);
|
start || (start = 0);
|
||||||
end || (end = this.length);
|
end || (end = this.length);
|
||||||
|
target_start || (target_start = 0);
|
||||||
|
|
||||||
if (end < start) throw new Error("sourceEnd < sourceStart");
|
if (end < start) throw new Error("sourceEnd < sourceStart");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue