Is this file a good starting point for accessing data inside this json file via javascript classes? I was given a spreadsheet of data that I turned into a CSV file and then converted it into a JSON file.
I threw it into my application and I am processing it in the following manner:
const fs = require(&quot;fs&quot;);

class DataRepository {
  constructor(filename) {
    if (!filename) {
      throw new Error(&quot;Creating a repository requires a filename&quot;);
    }

    this.filename = filename;
    try {
      fs.accessSync(this.filename);
    } catch (error) {
      console.error(&quot;data does not exist&quot;);
    }
  }

  async getAll() {
    // Open the file called this.filename
    return JSON.parse(
      await fs.promises.readFile(this.filename, {
        encoding: &quot;utf-8&quot;,
      })
    );
  }

  async getOneBy(filters) {
    const records = await this.getAll();

    for (let record of records) {
      let found = true;

      for (let key in filters) {
        if (record[key] !== filters[key]) {
          found = false;
        }
      }

      if (found) {
        return record;
      }
    }
  }
}

module.exports = new DataRepository(&quot;cales_data.json&quot;);

With this approach, will I later be able to create some JavaScript classes to access values inside of it like so:
export class Address {
    constructor() {
        this.Address = repo.Address;
    }
}
Some issues:

The constructor recognizes an error if the file doesn't exist but, after logging, just behaves as if nothing is wrong.  It does not communicate back an error.  Probably, you should just let the exception go back to the caller or don't test it at all in the constructor and let the operation that actually uses the file get the error and communicate that error back to the caller then.

You're using a mix of synchronous and asynchronous file access.  That's usually a wrong choice because if you are in a programming situation where synchronous access is fine (like startup code or a single user script), then it's just simpler to use synchronous access everywhere.  If not (like in a server environment) and you should be using asynchronous access everywhere, then you should be using asynchronous access everywhere.

If you're doing this synchronously in nodejs, then require() of a filename with a .json file extension will automatically read and parse the file for you.

It's not clear why any of this involves methods on an instantiated object.  These are all stand-alone functions.  While you do access this.filename, that is not required if you just pass the filename to getAll().