(p: string, cb: BFSCallback<string[]>)
| 279 | } |
| 280 | |
| 281 | public readdir(p: string, cb: BFSCallback<string[]>): void { |
| 282 | const fsInfo = this._getFs(p); |
| 283 | fsInfo.fs.readdir(fsInfo.path, (err, files) => { |
| 284 | if (fsInfo.fs !== this.rootFs) { |
| 285 | try { |
| 286 | const rv = this.rootFs.readdirSync(p); |
| 287 | if (files) { |
| 288 | // Filter out duplicates. |
| 289 | files = files.concat(rv.filter((val) => files!.indexOf(val) === -1)); |
| 290 | } else { |
| 291 | files = rv; |
| 292 | } |
| 293 | } catch (e) { |
| 294 | // Root FS and target FS did not have directory. |
| 295 | if (err) { |
| 296 | return cb(this.standardizeError(err, fsInfo.path, p)); |
| 297 | } |
| 298 | } |
| 299 | } else if (err) { |
| 300 | // Root FS and target FS are the same, and did not have directory. |
| 301 | return cb(this.standardizeError(err, fsInfo.path, p)); |
| 302 | } |
| 303 | |
| 304 | cb(null, files); |
| 305 | }); |
| 306 | } |
| 307 | |
| 308 | public rmdirSync(p: string): void { |
| 309 | const fsInfo = this._getFs(p); |
nothing calls this directly
no test coverage detected