Uuid: Buffer deprecation warning

Created on 25 Oct 2018  路  2Comments  路  Source: uuidjs/uuid

Hi, for anyone using this package with Node 10+ the following warning appears:

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

It does appear that Buffer() may be used in the md5 and sha1 libraries, and possibly elsewhere that I didn't see. Is it possible to change these? new Buffer was deprecated in node 10. In most cases you can use the Buffer.from() methods in the same way as new Buffer and avoid the warning (alloc and allocUnsafe come in to play when initializing a Buffer of a specific size)

Most helpful comment

More information/documentation from node: https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/

All 2 comments

More information/documentation from node: https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/

Ran npm test with node 10 and 11, and am not seeing this warning. All code in this module that creates buffers is "smart" about detecting the new api. E.g. https://github.com/kelektiv/node-uuid/blob/master/lib/md5.js

Closing for now, as I suspect this warning is coming from calling code. If this is still a problem for you feel free to submit a PR with the fix, though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sam-s4s picture sam-s4s  路  6Comments

danactive picture danactive  路  3Comments

ctavan picture ctavan  路  5Comments

Kmaschta picture Kmaschta  路  5Comments

8bitjoey picture 8bitjoey  路  5Comments