Prefer modern Buffer allocation methods over the deprecated Buffer constructor.
✅ This rule is included in the node logical presets.
The new Buffer() constructor has been deprecated since Node.js 4 due to security and usability concerns.
Modern alternatives provide safer and more explicit ways to create buffers.
Use Buffer.from() for creating a Buffer from existing data (strings, arrays, or ArrayBuffers).
Use Buffer.alloc() for creating a Buffer of a specific size with zero-filled memory.
AEconsB0buffAE <= sp ansty="le--0:#7FDBCA;--1:#096E">72n= sp>AB0Buff5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D7468697320697320612074c3a9731"sp><74sp ansty="le--0:#D9F5DD;--1:#1111">174sp><1"sp ansty="le--0:#C792EA;--1:#8844">AE1"sp><, sp ansty="le--0:#D9F5DD;--1:#1111">1, sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Dh1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><);d ivclassNa="meec-li">d);d>AEconsB0buffAE <= sp ansty="le--0:#7FDBCA;--1:#096E">72n= sp>AB0Buff53<([sp ansty="le--0:#F78C6C;--1:#AA09">820x([sp><62sp ansty="le--0:#D6DEEB;--1:#403F">5362sp><, sp ansty="le--0:#F78C6C;--1:#AA09">820x, sp><75sp ansty="le--0:#D6DEEB;--1:#403F">5375sp><, sp ansty="le--0:#F78C6C;--1:#AA09">820x, sp><66sp ansty="le--0:#D6DEEB;--1:#403F">5366sp><, sp ansty="le--0:#F78C6C;--1:#AA09">820x, sp><66sp ansty="le--0:#D6DEEB;--1:#403F">5366sp><, sp ansty="le--0:#F78C6C;--1:#AA09">820x, sp><65sp ansty="le--0:#D6DEEB;--1:#403F">5365sp><, sp ansty="le--0:#F78C6C;--1:#AA09">820x, sp><72sp ansty="le--0:#D6DEEB;--1:#403F">53]72sp><);d ivclassNa="meec-li">d);d>AEconsB0buffAE <= sp ansty="le--0:#7FDBCA;--1:#096E">72n= sp>AB0Buff5<3(sp ansty="le--0:#F78C6C;--1:#AA09">823(sp><10sp ansty="le--0:#D6DEEB;--1:#403F">5310sp><);d ivclassNa="meco"><);d>);d>);d> 44AEco61B0bu44A3F53Bu4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B04AE.>31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D7468697320697320612074c3a9111"><7374 spans="tyle--0:#D9F5DD;--1:#11">17374><111" spans="tyle--0:#C792EA;--1:#88">44111">1<111" spans="tyle--0:#ECC48D;--1:#98">4E4111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53) ;divclass="Nameec-">c53)>44AEco61B0bu44A3F53Bu4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B04AE.>3F<53([ spans="tyle--0:#F78C6C;--1:#AA">098253([><0x62 spans="tyle--0:#D6DEEB;--1:#40">3F0x62><53, spans="tyle--0:#F78C6C;--1:#AA">098253, ><0x75 spans="tyle--0:#D6DEEB;--1:#40">3F0x75><53, spans="tyle--0:#F78C6C;--1:#AA">098253, ><0x66 spans="tyle--0:#D6DEEB;--1:#40">3F0x66><53, spans="tyle--0:#F78C6C;--1:#AA">098253, ><0x66 spans="tyle--0:#D6DEEB;--1:#40">3F0x66><53, spans="tyle--0:#F78C6C;--1:#AA">098253, ><0x65 spans="tyle--0:#D6DEEB;--1:#40">3F0x65><53, spans="tyle--0:#F78C6C;--1:#AA">098253, ><0x72 spans="tyle--0:#D6DEEB;--1:#40">3F50x72><3]) ;divclass="Nameec-">c3])>44AEco61B0bu44A3F53Bu4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0a4AE.>309<8210 spans="tyle--0:#D6DEEB;--1:#40">3F8210><53) ;divclass="Name"><10)>10)>53)>
This rule is not configurable.
If you are working with legacy code that specifically requires the old Buffer constructor (which is highly unlikely in modern codebases), you might choose not to enable this rule.