springernature / boomcatch

A standalone, node.js-based beacon receiver for boomerang.
GNU General Public License v3.0
110 stars 33 forks source link

Avoid using deprecated Buffer constructor #94

Open josebolos opened 6 years ago

josebolos commented 6 years ago

new Buffer() has been marked as deprecated in Node.js 10 due to security concerns.

Running boomcatch with NODE_OPTIONS=--trace-warnings shows a deprecation notice in forwarders/udp.js.

[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (buffer.js:159:11)
    at new Buffer (buffer.js:174:3)
    at sendToSocket (/Users/jose.bolos/devel/boomcatch/src/forwarders/udp.js:63:22)
    at send (/Users/jose.bolos/devel/boomcatch/src/forwarders/udp.js:55:16)
    at send (/Users/jose.bolos/devel/boomcatch/src/index.js:670:9)
    at IncomingMessage.emit (events.js:182:13)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

We probably want to fix this to ensure compatibility with future versions of node.js.