Type d'évaluation
Mise en situation réelle
Analyse
Intelligence Artificielle
Compétences ciblées
Scénario Technique
Context A script must read a JSON configuration file, modify one field, and write the updated content back to disk. The Problem The developer is using synchronous blocking calls (fs.readFileSync) inside an async context, causing event loop blocking. Current Code const data = fs.readFileSync("config.json"); const config = JSON.parse(data); config.version = "2.0"; fs.writeFileSync("config.json", JSON.stringify(config)); Constraints Replace synchronous calls with fs.promises equivalents. Use async/await for readability. Handle file-not-found errors explicitly. Expected Deliverable A Node.js script using fs.promises to read, modify, and write a JSON file asynchronously with proper error handling.
Prêt à évaluer ce talent ?
Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.