获取图片
var readDir = require('readdir');
var fs = require('fs');
function getImages(){
var imgarr = [];
imgarr = readDir.readSync('images');
return imgarr;
}
function writeFile(){
var imgarr = getImages();
fs.writeFile('imglist.js',imgarr,function(err){
if(err) throw err;
console.log('生成文件成功')
})
}
writeFile();