showing results for - "how to write and read a text file in jdiscord js"
Matías
30 Sep 2018
1npm install fs --save -g
2//You can read from the file like this:
3// File system stuff.
4var fs = require("fs");
5
6// Get the text file and load it into a variable.
7var file = fs.readFileSync("path/to/my/text/file.txt", "utf8");
8
9//And you can write to the file like this:
10// Write the file
11fs.writeFile("path/to/my/text/file.txt", myVariable, function (err) {
12
13    // Checks if there is an error
14    if (err) return console.log(err);
15  });