SHOW:
|
|
- or go back to the newest paste.
1 | router.get("/fileList", function(req, res){ | |
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 | - | |
11 | + | if( loop.isLast ){ |
12 | callback() | |
13 | } | |
14 | ||
15 | }); | |
16 | }); | |
17 | ||
18 | ||
19 | console.log(fileList); | |
20 | ||
21 | res.send(fileList); | |
22 | }); | |
23 | ||
24 | ||
25 | }); |