SHARE
TWEET

Untitled

a guest Sep 16th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function loadMessage(path, next){
  2.     fs.readFile(__dirname + "/data/" + path, (err, data) => {
  3.         if (err) {
  4.             messages = [];
  5.         }
  6.         else {
  7.             try {
  8.                 messages = JSON.parse(data);
  9.                 next();
  10.             } catch (e) {
  11.                 messages = [];
  12.                 console.error(e);
  13.                 console.log(" File "+path + "not a valid JSON file");
  14.             }
  15.         }
  16.     });
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top