02 / Beginner tutorial / 8 min read

How to use REA: follow an app’s Export button

You click “Export notes”, but where does the CSV file go? Use REA to follow the button through a small Electron app, then test the code that formats the file.

On this page
JavaScript / ElectronNo native engineOfficial teaching sample
What you will learn
  • Download a small app and give its folder path to REA.
  • Find the export handler and the intended destination: Downloads/notes.csv.
  • Run a short check to see whether commas and quotation marks export correctly.

01. Choose one question

“Explain this app” is a large request. Start with a behavior you can name and an answer you can check:

Our question
When I click Export notes, where does the CSV file go, and what happens if a note title contains commas or quotation marks?

We use the official REA Notes example: six small files representing an Electron app. This is a teaching sample, not a production application. Its static analysis needs no Electron installation.

02. Get the sample

Download notes-example.zip from rea.tools and extract it into a new folder. Keep the folder path handy. You should see:

Sample files
notes-example/
  package.json
  index.html
  renderer.js
  preload.js
  main.js
  csv.js

If REA is not connected yet, follow the installation guide. This sample can be inspected without launching a desktop window.

03. Ask your agent to inspect it

Replace the sample path in this prompt with the absolute path to your extracted folder.

Analysis prompt
Use REA to statically inspect /absolute/path/to/notes-example. Trace the Export notes button through the renderer, preload bridge and main process. Show the output file path, CSV columns, and the files and lines that support your answer. Do not launch Electron. Separate observed code from assumptions.

You can also collect REA’s static evidence directly from the terminal:

Terminal
npx -y rea-agents@6.4.0 analyze-javascript-application "/absolute/path/to/notes-example" --json > notes-analysis.json

The command pins the version used for this walkthrough. The JSON is analysis evidence, not a natural-language explanation; your coding agent uses it to guide follow-up inspection.

04. Follow the export path

The answer: the app is written to save notes.csv in the operating system’s Downloads folder. The setting is in main.js. Here is how the button reaches that code.

Button→Preload→IPC→CSV file

In Electron, the page and the main app run separately. Preload exposes a method the page can call. IPC is the message that carries the request to the main app, which can write the file.

LocationWhat the code does
renderer.jsThe click handler calls window.notes.exportCsv().
preload.jsThe exposed method invokes the notes:export IPC channel.
main.jsThe matching handler builds a Downloads path and writes notes.csv.
csv.jsThe formatter writes id,title, quotes each title and doubles embedded quotes.

The code uses Electron’s app.getPath("downloads"). That establishes the intended destination; it does not prove a file was actually written on your machine. This walkthrough checks the formatter directly below.

05. Check a prediction

Give the formatter a note whose title is Hello, "REA". The predicted CSV row is:

Expected output
id,title
1,"Hello, ""REA"""

The comma stays inside one quoted field. Each embedded quotation mark becomes two quotes. To verify this, save the following as check.cjs inside the extracted notes-example folder:

check.cjs
const assert = require("node:assert/strict");
const { toCsv } = require("./csv.js");

const actual = toCsv([{ id: 1, title: 'Hello, "REA"' }]);
const expected = 'id,title\n1,"Hello, ""REA"""\n';
assert.equal(actual, expected);
console.log(actual);
console.log("PASS: comma and quotes stay in one field.");
Run from the sample folder
node check.cjs

Verified locally. We ran the REA 6.4.0 static analysis and this formatter check on October 12, 2026. The output matched. We did not launch the Electron UI or test filesystem permissions through its export button.

06. Continue with a sharper question

Now try a follow-up that tests the explanation rather than asking for more general description:

Follow-up prompt
If writing notes.csv fails, how would that error travel back to the page? Trace the error handling in the supplied files. Identify any missing handler, but do not modify the app.

Keep three things in every report: the finding, its source location, and what you actually tested. This makes it easier to catch a plausible explanation that goes beyond the evidence.

Next / Real package exampleFind why a generated URL still contains “!”.

Sample and workflow: REA’s official first investigation. This page is an independent walkthrough, with an additional local analysis and formatter check. Download the analysis summary.

New to the tool? What is REA? · How we check our guides