Website for visualizing a persons github network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
717 B

  1. /** Used to read and write files from disk */
  2. const fs = require('fs');
  3. module.exports =
  4. {
  5. writeJSONToFile: function(fileName, jsonObject)
  6. {
  7. const json = JSON.stringify(jsonObject, null, 4);
  8. fs.writeFile(fileName, json, 'utf8', function()
  9. {
  10. console.log("Wrote to " + fileName);
  11. });
  12. },
  13. /**
  14. *
  15. * @param fileName
  16. * @returns {any}
  17. */
  18. getFileAsJSON: function(fileName)
  19. {
  20. return JSON.parse(module.exports.getFile(fileName));
  21. },
  22. getFile: function(filename)
  23. {
  24. return fs.readFileSync(filename, 'utf8');
  25. }
  26. };