Replace deprecated Buffer() constructor with Buffer.alloc() and Buffer.from()

Proprietary

Replace deprecated new Buffer(...) and Buffer(...) calls with Buffer.alloc(size) for a numeric size and Buffer.from(...) for strings, arrays, buffers and array buffers. Calls are left unchanged when the argument's type doesn't show which one applies, such as an untyped value, any, or string | number.

org.openrewrite.node.migrate.buffer.replace-deprecated-constructor
mod run . --recipe=org.openrewrite.node.migrate.buffer.replace-deprecated-constructor

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.