From bb5172124f8239da2747c4ad24319c067fe5cdf8 Mon Sep 17 00:00:00 2001 From: mathmakgakpak <44949126+mathmakgakpak@users.noreply.github.com> Date: Sun, 18 Oct 2020 17:28:17 +0200 Subject: [PATCH] add aliases --- index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.js b/index.js index e87bfaa..4ed45fd 100644 --- a/index.js +++ b/index.js @@ -1113,6 +1113,7 @@ function checkOffset (offset, ext, length) { if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } +Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 @@ -1128,6 +1129,7 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) return val } +Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 @@ -1144,24 +1146,28 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) return val } +Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } +Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } +Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } +Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) @@ -1172,6 +1178,7 @@ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { (this[offset + 3] * 0x1000000) } +Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) @@ -1289,6 +1296,7 @@ function checkInt (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') } +Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 @@ -1308,6 +1316,7 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, return offset + byteLength } +Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 @@ -1327,6 +1336,7 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, return offset + byteLength } +Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 @@ -1335,6 +1345,7 @@ Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { return offset + 1 } +Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 @@ -1344,6 +1355,7 @@ Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert return offset + 2 } +Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 @@ -1353,6 +1365,7 @@ Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert return offset + 2 } +Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 @@ -1364,6 +1377,7 @@ Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert return offset + 4 } +Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 -- 2.34.1