Answers for "how to return a file in node js"

2

read a file nodejs

const fs = require('fs');

fs.readFile('my-file.txt', 'utf8', function(err, data) {
    if (err) throw err;
    console.log(data);
});
Posted by: Guest on April-17-2021

Code answers related to "how to return a file in node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language