-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
avoid process.binding() where possible #5
Conversation
process.binding() is deprecated. When running recent versions of Node.js with --pending-deprecation, the current code results in a printed warning about process.binding() usage. process.binding() is used to create writev(), but Node.js now exposes fs.writev(). Use that instead when it exists. Otherwise, fall back to the polyfill. This will avoid runtime deprecation messages for end users. If the minimum supported engine is ever Node.js 12.9.0 or above, the polyfill code should be removable at that time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Two comments.
@Trott are these changes |
I believe this will support all versions of Node.js that the current version supports. It uses the new feature if it exists, otherwise it falls back to the previous code. |
(Pushed another commit to add a comment indicating that the polyfill block is needed for Node.js earlier than 12.9.0 so that it can be removed in a few years if support for earlier versions is no longer needed.) |
process.binding() is deprecated. When running recent versions of Node.js
with --pending-deprecation, the current code results in a printed
warning about process.binding() usage. process.binding() is used to
create writev(), but Node.js now exposes fs.writev(). Use that instead
when it exists. Otherwise, fall back to the polyfill. This will avoid
runtime deprecation messages for end users.
If the minimum supported engine is ever Node.js 12.9.0 or above, the
polyfill code should be removable at that time.