Performance: Error-first callback convention
MEDIUM IMPACT
This pattern affects how asynchronous operations handle errors and results, impacting responsiveness and error handling flow in Node.js applications.
fs.readFile('file.txt', (err, data) => { if (err) { console.error('Error:', err); return; } console.log(data.toString()); });
fs.readFile('file.txt', (data) => { if (!data) { console.log('Error occurred'); return; } console.log(data.toString()); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Error-first callback | N/A (Node.js backend) | N/A | N/A | [OK] Good |
| Non-error-first callback | N/A | N/A | N/A | [X] Bad |