diff --git a/core/fnv1a.js b/core/fnv1a.js index ce1fe105..1b8ece32 100644 --- a/core/fnv1a.js +++ b/core/fnv1a.js @@ -38,7 +38,7 @@ module.exports = class FNV1a { digest(encoding) { encoding = encoding || 'binary'; - let buf = Buffer.alloc(4); + const buf = Buffer.alloc(4); buf.writeInt32BE(this.hash & 0xffffffff, 0); return buf.toString(encoding); } diff --git a/core/ftn_mail_packet.js b/core/ftn_mail_packet.js index 5db02227..c42d859b 100644 --- a/core/ftn_mail_packet.js +++ b/core/ftn_mail_packet.js @@ -273,7 +273,7 @@ function Packet(options) { }; this.getPacketHeaderBuffer = function(packetHeader) { - let buffer = Buffer.from(FTN_PACKET_HEADER_SIZE); + let buffer = Buffer.alloc(FTN_PACKET_HEADER_SIZE); buffer.writeUInt16LE(packetHeader.origNode, 0); buffer.writeUInt16LE(packetHeader.destNode, 2); @@ -311,7 +311,7 @@ function Packet(options) { }; this.writePacketHeader = function(packetHeader, ws) { - let buffer = Buffer.from(FTN_PACKET_HEADER_SIZE); + let buffer = Buffer.alloc(FTN_PACKET_HEADER_SIZE); buffer.writeUInt16LE(packetHeader.origNode, 0); buffer.writeUInt16LE(packetHeader.destNode, 2); @@ -747,7 +747,7 @@ function Packet(options) { async.waterfall( [ function prepareHeaderAndKludges(callback) { - const basicHeader = Buffer.from(34); + const basicHeader = Buffer.alloc(34); self.writeMessageHeader(message, basicHeader); // @@ -864,7 +864,7 @@ function Packet(options) { }; this.writeMessage = function(message, ws, options) { - let basicHeader = Buffer.from(34); + const basicHeader = Buffer.alloc(34); self.writeMessageHeader(message, basicHeader); ws.write(basicHeader); diff --git a/core/ftn_util.js b/core/ftn_util.js index e40d2687..d1f69e0f 100644 --- a/core/ftn_util.js +++ b/core/ftn_util.js @@ -46,7 +46,7 @@ exports.getQuotePrefix = getQuotePrefix; // See list here: https://github.com/Mithgol/node-fidonet-jam function stringToNullPaddedBuffer(s, bufLen) { - let buffer = Buffer.alloc(bufLen).fill(0x00); + let buffer = Buffer.alloc(bufLen); let enc = iconv.encode(s, 'CP437').slice(0, bufLen); for(let i = 0; i < enc.length; ++i) { buffer[i] = enc[i];