The Read/Edit/Write Loop

If want to quickly jot down notes or just edit text files, use the read, edit, write loop:

let filePath = tmpPath("") //tmpPath is a temp dir based on the script name
let contents = await ensureReadFile(filePath)
while (true) {
// `editor` will be paywalled in the future. Use `textarea` if you don't want to support us 😢
contents = await editor(contents) // hit cmd+s to "submit" and continue back in the loop. cmd+w to close.
await writeFile(filePath, contents)
Discuss Post