Performance: Writing files
MEDIUM IMPACT
This affects page load speed indirectly by blocking the event loop during file write operations, impacting responsiveness and user experience.
import { writeFile } from 'node:fs/promises'; await writeFile('output.txt', 'Hello World');
const fs = require('fs'); fs.writeFileSync('output.txt', 'Hello World');
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous writeFileSync | 0 | 0 | 0 | [X] Bad |
| Asynchronous writeFile (promises) | 0 | 0 | 0 | [OK] Good |