Last active
December 28, 2017 12:09
-
-
Save garenyondem/e2277cfa76dc4f6dd9baabe84e693c99 to your computer and use it in GitHub Desktop.
NodeJS Nedir?
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
{ | |
"Author": "Garen", | |
"Message": "Hello World" | |
} |
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 currentDir = process.cwd(); | |
const fs = require('fs'); | |
(function init() { | |
let dataFilePath = currentDir + '/data.json'; | |
let encoding = 'utf8'; | |
const callback = (err, content) => { | |
if (!err) { | |
console.log(content) | |
} else { | |
console.log(err) | |
} | |
}; | |
fs.readFile(dataFilePath, encoding, callback); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment