// Name: Save Mic Recording // Description: Records audio using the default microphone and saves to RECORDER_PATH. // Author: benhaotang // GitHub: benhaotang import "@johnlindquist/kit" const recordingsDir = await env("RECORDER_PATH", async () => { return await path({ placeholder: "Select a folder to save recordings", onlyDirs: true, }) }) await ensureDir(recordingsDir) await notify("Recording… Press Enter to stop") const buffer = await mic() const timestamp = formatDate(new Date(), "yyyy-MM-dd-HH-mm-ss") const filename = `recording-${timestamp}.webm` const toPath = createPathResolver(recordingsDir) const outputPath = toPath(filename) await writeFile(outputPath, buffer) await revealFile(outputPath) await notify(`Saved: ${filename}`)