npm / fstream

Advanced FS Streaming for Node
ISC License
208 stars 43 forks source link

Avoid using deprecated Buffer API #61

Open ChALkeR opened 6 years ago

ChALkeR commented 6 years ago

Use Buffer.from when it's available instead of new Bufer(string)

Fixes: https://github.com/npm/fstream/issues/60 Refs: https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor Tracking: https://github.com/nodejs/node/issues/19079

Given that this is a highly popular module and that Buffer constructor was used in a single place, I decided to add a minimal polyfill in-place (like I do in other similar situations) instead of adding a dependnecy.

/cc @zkat