({ dir })
| 14 | } |
| 15 | |
| 16 | static async read({ dir }) { |
| 17 | const files = fs.readdirSync(dir); |
| 18 | return files.map((path) => { |
| 19 | const content = fs.readFileSync(`${dir}/${path}`, { |
| 20 | encoding: 'utf-8', |
| 21 | }); |
| 22 | return { |
| 23 | path, |
| 24 | content, |
| 25 | }; |
| 26 | }); |
| 27 | } |
| 28 | |
| 29 | static async has({ dir }) { |
| 30 | return fs.existsSync(dir); |