Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var readFiles = function(onSuccess){
- var fileList=[];
- fs.readdir("./public/txt", function(err, files){
- files.forEach(function (file){
- fileList.push(file);
- fs.stat("./public/txt/"+file, function(err, status){
- console.log(status.mtime);
- fileList.push(status.mtime);
- if( loop.isLast ){
- onSuccess(fileList);
- }
- });
- });
- });
- }
- router.get("/fileList", function(req, res){
- readFiles(function(result){
- res.send(result);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement