这个fs.readdir路径要加上__dirname 找到绝对路径 否则会报错
{ Error: ENOENT: no such file or directory, scandir '/Users/**/Desktop/demo/test/test/' errno: -2, code: 'ENOENT', syscall: 'scandir', path: '/Users/**/Desktop/demo/test/test/' }
fs.readdir(__dirname+"/public/",function(err, files){ if (err) { return console.error(err); } files.forEach( function (file){ console.log( file ); }); })