(folderPath: string, removeOwnFolder: boolean = false)
| 250 | } |
| 251 | |
| 252 | clearFolder(folderPath: string, removeOwnFolder: boolean = false): FileSystem { |
| 253 | if(this.folderDoesNotExist(folderPath)) return this |
| 254 | |
| 255 | console.log('Clearing Folder: ' + folderPath) |
| 256 | |
| 257 | fs.readdirSync(folderPath).forEach((file) => { |
| 258 | const curPath = path.join(folderPath, file) |
| 259 | |
| 260 | if (fs.lstatSync(curPath).isDirectory()) { |
| 261 | this.clearFolder(curPath, true) |
| 262 | } else { |
| 263 | fs.unlinkSync(curPath) |
| 264 | } |
| 265 | }) |
| 266 | |
| 267 | if(removeOwnFolder) { |
| 268 | fs.rmdirSync(folderPath) |
| 269 | } |
| 270 | |
| 271 | return this |
| 272 | } |
| 273 | |
| 274 | walkSync( |
| 275 | dir: string, |
no test coverage detected