I want to send to client filename and file created date, I tried to use fs.stat that provides birthtime but i dont see filename in there, SO my question, is birthtime is file created date ?
How can i send filename and date created as json ?
app.js
var readDirectory = require('./readDirectory');
app.get('/logs',function(req,res){
readDirectory.readDirectory(function(logFiles){
res.json(logFiles);
});
});
readDirectory.js
var fs = require('fs');
var path = './logs/ditLogs'
function readDirectory(callback){
fs.stat(path, function (err,stats) {
console.log('STATS',stats);
callback(stats);
});
}
exports.readDirectory = readDirectory;