1.0.0 • Published 3 years ago
yz-dome v1.0.0
杨招小dome
const fs = require('fs');
class ReadFile{
constructor (options){
Object.assign(this,{},options);
const inof = fs.statSync(this.pathDir);
if(inof.isFile()){
const a = fs.readFileSync(this.pathDir,'utf-8');
console.log(a);
}else{
const arr = fs.readdirSync(this.pathDir);
arr.forEach(item=>{
item = this.pathDir + "/" + item;
const a = fs.readFileSync(item,'utf-8');
console.log(a);
})
}
}
}
new ReadFile({
pathDir:'dome01'
})
1.0.0
3 years ago