'How can I make the fetch command (or any other) read a file that I upload at the moment and NOT link to one that I already have in Chart JS?

How can I make the fetch command (or any other) read a file that I upload at the moment and NOT link to one that I already have in Chart JS?

For example:

  async function getData() {
    const response = await fetch("ZonAnn.Ts+dSST.csv");
    const data = await response.text();
    const years = [];
    const temps = [];

    const rows = data.split("\n").slice(1);
    rows.forEach(row => {
      const cols = row.split(",");
      years.push(cols[0]);
      temps.push(14 + parseFloat(cols[1]));
    });
    return { years, temps };
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source