Async await loop
up:: JavaScript Arrays
This is required because .forEach
doesn’t run asynchronosly. More on that here: Asynchronous iteration • JavaScript for impatient programmers (ES2022 edition).
for await (const el of notes) {
try {
await Bun.write(el.title, el.content);
} catch (e) {
console.warn("Error writing", el.title, e);
}
}