Migration

DEP0005: migrate Buffer constructor

Replace deprecated Buffer constructor calls with explicit conversion or initialized allocation. Audit numeric arguments separately from string arguments. Tested on Node.js 22.16.0. Example output (one line per entry): ["book 0000"].

Formal Syntax & Structure

nodejs syntaxnodejs
Buffer.from(value); Buffer.alloc(size)

Return Value

Migration outcome

Replacement behavior shown by the example.

Working Example

Example Snippetnodejs
console.log(Buffer.from('book').toString(), Buffer.alloc(2).toString('hex'));
Node.js Reference