I'm just studying Node.JS, and i have a question over it.
I have to read a file. I do it with 'fs' node and 'fs.readFile()' func. Here is a code
const fs = require('fs');
let input;
fs.readFile('./'+config.file, (err, data) => {
input = data.toString('utf-8');
});
console.log(input) //!!! it gives me 'undefined' result but i expect file's data
I haven't any ideas how solve this problem. Only i know that this is the async func.
Hope, you will help me :3