Nnodejs

nodejs/slow-buffer-to-buffer-alloc-unsafe-slow

Handle DEP0030 via transforming SlowBuffer usage to Buffer.allocUnsafeSlow().

transformationmigrationbufferslowbuffer
Public
2 downloads
2 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

SlowBuffer to Buffer.allocUnsafeSlow Codemod

This codemod migrates deprecated SlowBuffer usage to Buffer.allocUnsafeSlow() to handle Node.js DEP0030.

What it does

This codemod transforms:

  1. SlowBuffer constructor calls to Buffer.allocUnsafeSlow()
  2. Direct SlowBuffer calls to Buffer.allocUnsafeSlow()
  3. Import/require statements be synced with new function

Example

Before:

javascript

After:

javascript

Ready to contribute?

Build your own codemod and share it with the community.