Regarding Buffer
See original GitHub issueA little background:
new Buffer(size)
is deprecated: https://nodejs.org/api/buffer.html#buffer_new_buffer_sizeBuffer.alloc()
orBuffer.allocUnsafe()
should be used instead, but it’s not supported on Node.js v4.0.0-v4.5.0.- https://github.com/jprichardson/node-fs-extra/pull/380 switched us to
Buffer.alloc()
. This was released in fs-extra v2.1.0 - People complained about the lack of Node v4.3.0 support: https://github.com/jprichardson/node-fs-extra/issues/390
- I reverted #380 in e02c07bc26edfca0b9602a9ac142a344ed020aad, and released fs-extra v2.1.1 as a hotfix for this.
Now, what are we going to do moving forward? Using new Buffer()
emits a deprecation warning in Node v7.0.0-v7.2.1.
I’m wondering if we shouldn’t consider some sort of fallback solution.
Also, this brings up the security question that prompted Node to change the Buffer API in the first place: new Buffer
returns an uninitialized buffer. Currently, we are not zero-filling it. I can’t see how this could be exploited in the current implementation, but it would be good to have this reviewed.
If we do not need the buffer to be initialized, we should use Buffer.allocUnsafe
, not Buffer.alloc
, in later versions.
Atten: @jprichardson @manidlou @dr-dimitru
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Which of the following is correct regarding buffer solution?
Which of the following is correct regarding buffer solution? A. It contains weak acid and its conjugate base. B ...
Read more >17.2: Buffer Solutions - Chemistry LibreTexts
Buffers are solutions that maintain a relatively constant pH when an acid ... For buffer concentrations of at least 0.500 M, the addition...
Read more >Buffer solution - Wikipedia
A buffer solution is an aqueous solution consisting of a mixture of a weak acid and its ... In nature, there are many...
Read more >A buffer is a solution that resists changes in pH upon the ...
A buffer is composed of a mixture·of a weak acid its conjugate base. ... (Note: For a buffer to resist changes in pH,...
Read more >Buffer: All-you-need social media toolkit for small businesses
Buffer helps you build an audience organically. We're a values-driven company that provides affordable, intuitive, marketing tools for ambitious people and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@RyanZim good point. Let’s just go with
allocUnsafe()
@dr-dimitru looks good!
Hi @jprichardson
Here is my snipped from #380 thread: