Skip to content

Conversation

ARitz-Cracker
Copy link

new Buffer is deprecated, so Buffer.from should be used if it's available

new Buffer is deprecated
@addaleax
Copy link

This would be very nice to have :) @creationix?

@creationix
Copy link
Owner

This is great, but there is no need to check every time the function is called. Instead of having the indirection that checks at runtime every time the function is called, simply set the function.

// Use Buffer.from directly if it exists.  Otherwise, create a version of the constructor that works like a function.
const bufferFrom = Buffer.from ? Buffer.from : (...args) => new Buffer(...args);

@adminy
Copy link

adminy commented Oct 27, 2023

ok, but can this be addressed? its been 2 years now

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

Successfully merging this pull request may close these issues.

4 participants