Filtered rows are joined into CSV text, wrapped in a Blob, and exposed through a download link.

Program

Blob and object URLs let browser apps offer generated files without a server round trip.

download_csv_blob.html
<a id="download" download="open-tasks.csv">Download open tasks</a>
<script>
  const rows = [["task", "status"], ["Build", "open"], ["Review", "done"]];
  const openRows = rows.filter(row => row[1] !== "done");
  const csv = openRows.map(row => row.join(",")).join("\n");
  const blob = new Blob([csv], { type: "text/csv" });
  download.href = URL.createObjectURL(blob);
</script>
Blob Blob represents generated file-like data in the browser.
object URL URL.createObjectURL creates a temporary URL for a Blob.