Convert Callbacks to Async/Await

Use Copilot to update legacy callback-style code to async/await.

category:refactoring
async-await
javascript
node
0

Prompt

Convert the following callback-based asynchronous code to use async/await.
  
  Requirements:
  - Preserve error handling behaviour.
  - Make sure all asynchronous functions are properly awaited.
  - Clean up nested callbacks or "callback hell" into linear async/await flow.
  
  Code:
  
  [Paste callback-based code here]