Skip to content

Calling Buffer constructor directly is deprecated #9562

@caphosra

Description

@caphosra

It seems that this project uses Buffer constructor on these two lines:

case '.png':
const buffer = new Buffer(payload.png.replace('data:image/png;base64', ''), 'base64');
await this.fs.writeLocalFile(file.fsPath, buffer);
break;

According to the nodejs document, we should use Buffer.from() or Buffer.alloc() instead of new Buffer(...).
I think it would be better if we replace it.

The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead.

Screenshot

Screen Shot 2022-04-02 at 20 19 32

Metadata

Metadata

Assignees

No one assigned

    Labels

    debtCode quality issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions