Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

new Buffer() is deprecated, use Buffer.from() #91

Closed
dludwig opened this issue Feb 24, 2020 · 1 comment · Fixed by #98
Closed

new Buffer() is deprecated, use Buffer.from() #91

dludwig opened this issue Feb 24, 2020 · 1 comment · Fixed by #98

Comments

@dludwig
Copy link

dludwig commented Feb 24, 2020

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 Object. ({redacted}/node_modules/lz4/lib/static.js:9:30)

thanks

@ankon
Copy link
Contributor

ankon commented Jun 21, 2020

Having this call isn't just "annoying", but actually costs speed: NodeJS will check for each buffer constructor call whether it possibly needs to log this warning, and these checks appear in profiles in our application.

ankon added a commit to ankon/node-lz4 that referenced this issue Jun 21, 2020
* Use Buffer.alloc/Buffer.from instead of "new Buffer"
* Remove the 'noAssert' parameter from the write calls
  This got removed with nodejs/node#18395

Fixes pierrec#91
ankon added a commit to ankon/node-lz4 that referenced this issue Jun 21, 2020
* Use Buffer.alloc/Buffer.from instead of "new Buffer"
* Remove the 'noAssert' parameter from the write calls
  This got removed with nodejs/node#18395

Fixes pierrec#91
pierrec pushed a commit that referenced this issue Jun 22, 2020
* Use Buffer.alloc/Buffer.from instead of "new Buffer"
* Remove the 'noAssert' parameter from the write calls
  This got removed with nodejs/node#18395

Fixes #91
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants