title: Alternative ways to parse local JSON file with functional approach?
body: <p>Below is the way I usually use to safely parse local JSON data in Node environment, mostly config files and some other relevant data:</p>
  
  <pre><code>const fs = require('fs')
  
  let localDb
  let parsedData
  
  try {
      localDb = fs.readFileSync('./file.json', 'utf8')
      parsedData = JSON.parse(localDb)
  } catch (err) {
      throw err
  }
  
  exports.data = parsedData
  </code></pre>
  
  <p>In the end, I export the parsed data from the JavaScript file for usage. While this works perfectly fine, I'm curious to know if there are better ways to do the same thing with a functional approach. </p>