Get data from fs.readFile

前端 未结 15 2483
滥情空心
滥情空心 2020-11-22 15:38
var content;
fs.readFile(\'./Index.html\', function read(err, data) {
    if (err) {
        throw err;
    }
    content = data;
});
console.log(content);
         


        
15条回答
  •  春和景丽
    2020-11-22 16:19

    var data = fs.readFileSync('tmp/reltioconfig.json','utf8');
    

    use this for calling a file synchronously, without encoding its showing output as a buffer.

提交回复
热议问题