Last active
November 24, 2020 09:46
-
-
Save Josh4324/eb59c7a6b7b0825fe4a51c3e19af0b70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listTodo = () => { | |
try { | |
// read from the todos.json if it exists | |
const todoBuffer = fs.readFileSync("todos.json"); | |
// convert it to string | |
let dataJSON = todoBuffer.toString(); | |
// parse the data | |
const todos = JSON.parse(dataJSON); | |
console.log(todos) | |
}catch(error){ | |
console.log("An error occured") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment