Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var readFiles = function(onSuccess){
  2.   var fileList=[];
  3.   fs.readdir("./public/txt", function(err, files){
  4.  
  5.     files.forEach(function (file){
  6.       fileList.push(file);
  7.       fs.stat("./public/txt/"+file, function(err, status){
  8.         console.log(status.mtime);
  9.         fileList.push(status.mtime);
  10.  
  11.     if( loop.isLast ){
  12.            onSuccess(fileList);
  13.         }
  14.  
  15.       });
  16.     });
  17.   });
  18. }
  19.  
  20. router.get("/fileList", function(req, res){
  21.    readFiles(function(result){
  22.       res.send(result);
  23.    });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement