This codemod migrates deprecated SlowBuffer usage to Buffer.allocUnsafeSlow() to handle Node.js DEP0030.
What It Does
This codemod transforms:
SlowBuffer constructor calls to Buffer.allocUnsafeSlow()
- Direct
SlowBuffer calls to Buffer.allocUnsafeSlow()
- Import/require statements to use
Buffer instead of SlowBuffer
Before/After
The SlowBuffer constructor was deprecated in Node.js v6.0.0 and removed in later versions. This migration is essential for maintaining compatibility with modern Node.js versions.
Usage
Run this codemod on your project:
Buffer.allocUnsafeSlow() creates a buffer outside the shared internal memory pool. Use this when you need a buffer that won’t be pooled, but remember that the buffer contents are uninitialized and may contain sensitive data.