Performance: Appending to files
MEDIUM IMPACT
This affects how fast data is written to disk and how the Node.js event loop handles file I/O operations.
import { appendFile } from 'fs/promises'; const data = 'New log entry\n'; await appendFile('log.txt', data);
const fs = require('fs'); const data = 'New log entry\n'; fs.appendFileSync('log.txt', data);
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous appendFileSync | N/A | N/A | N/A | [X] Bad |
| Asynchronous appendFile (Promise) | N/A | N/A | N/A | [OK] Good |