-
Notifications
You must be signed in to change notification settings - Fork 0
/
files.js
42 lines (33 loc) · 860 Bytes
/
files.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var fs = require('fs"),
logger = require('../lib/logger.js');
var dirPath = './models/';
var args;
var dirList = fileList(dirPath);
logger.info("dirList typefo"+dirList);
function fileList(p){
var filesOut = [];
var filesTemp = [];
fs.readdir(p, function(err, files){
if (err) return
files.forEach(function(f){
f.data = fileRead(p,f);
});
filesOut[i] = fileRead(p,files[i]);
}
logger.info("fileList > "+f);
return f;
});
}
function fileRead(p,dF){
var filesAndData;
logger.info("p+dF >"+p+dF);
fs.readFile(p+dF, function(err, file){
if (err) throw err;
/* var array = [];
array = file.toString().split('\n');
array = array.join(" <br> ");
logger.info("array"+array);
*/
return file;
});
}