标签:
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();
标签:
原文地址:http://www.cnblogs.com/smjia/p/5585160.html