-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
36 lines (34 loc) · 1.07 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Author : OBKoro1
* Date : 2020-07-15 21:32:18
* LastEditors : OBKoro1
* LastEditTime : 2020-07-16 22:09:15
* FilePath : \reactc:\Users\86187\run-success-icon\index.js
* Description :
* https://github.com/OBKoro1
*/
let fs = require('fs');
let path = require('path');
class RunSuccessIcon {
initRunIcon(option={}) {
let data,iconType,dirs=path.resolve(__dirname,'img');
iconType = option.iconType || 'buddha';
let files=fs.readdirSync(dirs);
let str=files.map(file=>path.join(dirs,file)).filter(file=>file.includes(iconType)).join()
data=fs.readFileSync(str,'utf-8');
return data;
}
handlerRunConfig(){
let data;
if(fs.existsSync(path.resolve(__dirname,'../../runIconConfig'))){
let dirs=path.resolve(__dirname,'../../runIconConfig');
let files=fs.readdirSync(dirs);
let file=files.map(file=>path.join(dirs,file)).join();
data=fs.readFileSync(file,'utf-8');
}
return data;
}
}
let obj=new RunSuccessIcon();
exports.initRunIcon=obj.initRunIcon;
exports.handlerRunConfig=obj.handlerRunConfig;