Skip to content

Deprecation Warning: new Buffer() Used in _readChunk #45

@suharsha

Description

@suharsha

I noticed that the package currently emits the following Node.js deprecation warning:

(node:<pid>) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues.
Please use Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() instead.

This warning appears because new Buffer() is used in the implementation of _readChunk:

const readBuffer = new Buffer(this.options.readChunk);

Recommended Fix

Replace:

const readBuffer = new Buffer(this.options.readChunk);

With the modern, safe alternative:

const readBuffer = Buffer.alloc(this.options.readChunk);

Why this matters

new Buffer() has been deprecated since Node.js 10.

It triggers runtime warnings and causes noise in logs.

Would you consider updating the package to use Buffer.alloc() instead?
Happy to submit a PR if helpful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions