-
Notifications
You must be signed in to change notification settings - Fork 50
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
Use Buffer.(from|alloc) instead of deprecated Buffer API #46
Conversation
This also includes a dependnecy on a polyfill targeting older Node.js versions where Buffer.alloc() and Buffer.from() API is not implemented (Node.js < 4.5.0 and some 5.x versions). Ref: nodejs/node#19079 Ref: https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor Ref: https://nodejs.org/api/buffer.html#buffer_class_buffer Ref: https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md
|
@arekinath would be great if you can merge this and release a new version as this is blocking Yarn from being Node 10 compatible. We can use the fork but that's less than ideal. |
Bump <3 Would love to get this (and yarnpkg/yarn#5477) fixed! |
Reviewed by: Alex Wilson <alex.wilson@joyent.com> Reviewed by: Cody Peter Mello <cody.mello@joyent.com>
Merged as 175758a, released in 1.14.2 |
@arekinath Thanks! |
@arekinath thanks a lot for the merge and release! It would be ideal if we can propagate this fix all the way to upstream. There are a few more fixes on joyent repos:
Do you think you can help with those too? And since sshpk depends on |
This also includes a dependnecy on a polyfill targeting older Node.js versions where Buffer.alloc() and Buffer.from() API is not implemented (Node.js < 4.5.0 and some 5.x versions).
This is mostly a line-to-line change, though in some cases, minor code simplification was done, e.g.
was transformed into
Ref: nodejs/node#19079
Ref: https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor
Ref: https://nodejs.org/api/buffer.html#buffer_class_buffer
Ref: https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md
Fixes: #45
Note that this does not completely solve the problem yet, for a complete solution,
asn1
(a dependency) should also receive this fix (see below for that one).But fixing the API usage in this package is still required, and a significant portion of tests pass without ever hitting the deprecated Buffer API in
asn1
dependency.