how to write and read a text file in jdiscord.js

JavaScript
npm install fs --save -g
//You can read from the file like this:
// File system stuff.
var fs = require("fs");

// Get the text file and load it into a variable.
var file = fs.readFileSync("path/to/my/text/file.txt", "utf8");

//And you can write to the file like this:
// Write the file
fs.writeFile("path/to/my/text/file.txt", myVariable, function (err) {

    // Checks if there is an error
    if (err) return console.log(err);
  });
Source

Also in JavaScript: