Pattern: Use of deprecated new Buffer()
constructor
Issue: -
The new Buffer()
constructor has been deprecated since Node.js 4. Use Buffer.from()
for creating a buffer from existing data or Buffer.alloc()
for creating a new buffer with allocated memory.
Example of incorrect code:
const buffer = new Buffer(10);
Example of correct code:
const buffer = Buffer.alloc(10);