Reto:
Una posible solución para el async/await sin importar el orden, podría ser usando Promise.all
const { readFile } = require('node:fs/promises')
const bootstrap = async () => {
try {
const [first, second, third] = await Promise.all([
readFile('./file.txt', { encoding: 'utf8' }),
readFile('./file2.txt', { encoding: 'utf8' }),
readFile('./file3.txt', { encoding: 'utf8' }),
])
console.log('[first file]:', first)
console.log('[second file]:', second)
console.log('[third file]:', third)
} catch (e) {
console.error(e)
}
}
bootstrap()