-
-
Notifications
You must be signed in to change notification settings - Fork 17
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededlet's do it
Description
Description
This codemod should migrate SlowBuffer
to Buffer.allocUnsafeSlow()
. It's useful to migrate code that uses the deprecated SlowBuffer class which has been removed.
It should handle both constructor usage and static method calls. It should support both SlowBuffer direct usage and destructured imports from buffer module
.
Examples
Case 1
Before:
const SlowBuffer = require('buffer').SlowBuffer;
// Using SlowBuffer constructor
const buf1 = new SlowBuffer(1024);
const buf2 = SlowBuffer(512);
// Direct import
const { SlowBuffer } = require('buffer');
const buf3 = new SlowBuffer(256);
After:
const { Buffer } = require('buffer');
// Using Buffer.allocUnsafeSlow()
const buf1 = Buffer.allocUnsafeSlow(1024);
const buf2 = Buffer.allocUnsafeSlow(512);
// Direct import
const { Buffer } = require('buffer');
const buf3 = Buffer.allocUnsafeSlow(256);
Case 2
Before:
import { SlowBuffer } from 'buffer';
const buf = new SlowBuffer(1024);
After:
import { Buffer } from 'buffer';
const buf = Buffer.allocUnsafeSlow(1024);
REFS
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededlet's do it
Type
Projects
Status
🔖 Todo