|
|
@ -328,3 +328,31 @@ Buffer.prototype.slice = function (start, end) { |
|
|
|
|
|
|
|
return new Buffer(this.parent, end - start, +start + this.offset); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Legacy methods for backwards compatibility.
|
|
|
|
|
|
|
|
Buffer.prototype.utf8Slice = function (start, end) { |
|
|
|
return this.toString("utf8", start, end); |
|
|
|
}; |
|
|
|
|
|
|
|
Buffer.prototype.binarySlice = function (start, end) { |
|
|
|
return this.toString("binary", start, end); |
|
|
|
}; |
|
|
|
|
|
|
|
Buffer.prototype.asciiSlice = function (start, end) { |
|
|
|
return this.toString("ascii", start, end); |
|
|
|
}; |
|
|
|
|
|
|
|
Buffer.prototype.utf8Write = function (string, offset) { |
|
|
|
return this.write(string, offset, "utf8"); |
|
|
|
}; |
|
|
|
|
|
|
|
Buffer.prototype.binaryWrite = function (string, offset) { |
|
|
|
return this.write(string, offset, "binary"); |
|
|
|
}; |
|
|
|
|
|
|
|
Buffer.prototype.asciiWrite = function (string, offset) { |
|
|
|
return this.write(string, offset, "ascii"); |
|
|
|
}; |
|
|
|
|
|
|
|