Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new Buffer() constructor is deprecated #46

Open
RomainOliva opened this issue Jan 4, 2022 · 0 comments
Open

new Buffer() constructor is deprecated #46

RomainOliva opened this issue Jan 4, 2022 · 0 comments

Comments

@RomainOliva
Copy link

RomainOliva commented Jan 4, 2022

if (typeof buffer === "string") buffer = new Buffer(buffer);

this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate, intVal)));

this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate)));

this.appendStringBuf(new Buffer(String.fromCharCode(intVal)));

Use Buffer constructor is currently depreciated :

It's not possible to deprecate Node.js ≤ 4.4.x and 5.0.0 — 5.9.x or maybe use a polyfill ?

Or maybe you can just use the alloc method to keep compatibility :

jsonparse/jsonparse.js

Lines 54 to 56 in b2d8bc6

function alloc(size) {
return Buffer.alloc ? Buffer.alloc(size) : new Buffer(size);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant