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

0

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

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);
  });
Posted by: Guest on January-16-2020

Code answers related to "how to write and read a text file in jdiscord.js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language