UNPKG

657 BJavaScriptView Raw
1const fs = require('fs');
2const path = require('path');
3const walk = require('walk');
4const config = require('./config');
5const md = require('./lib/marked');
6
7const walker = walk.walk(config.root);
8walker.on('file', function (root, fileStats, next) {
9 const basename = fileStats.name;
10 const ext = path.extname(basename);
11
12 const file = path.resolve(__dirname, root + '/' + basename);
13 // console.log(file);
14 if (ext === '.md') {
15 const txt = fs.readFileSync(file, 'utf-8');
16 console.log(txt);
17 }
18
19 next();
20});
21
22
23walker.on('end', () => {
24
25 // console.log('end');
26});
27
28walker.on('error', (e) => {
29 console.log(e);
30})
\No newline at end of file