Closed
Description
Is your feature request related to a problem? Please describe.
In node v12, fs.promises.writeFileHandle
performs needless data copying when writing a Uint8Array. See:
https://github.com/nodejs/node/blob/v12.x/lib/internal/fs/promises.js#L151
If data
is a Uint8Array, the local variable buffer
will actually be a Uint8Array
object. Calling .slice
on a Uint8Array creates a shallow copy of the values. This is documented both on MDN and in the node documentation.
Describe the solution you'd like
Don't use .slice
on Uint8Arrays
Describe alternatives you've considered
Manually making a Buffer out of my Uint8Array before calling fs write functions.
Thanks for all your hard work in making Node awesome!