| 483 | // ==================== Async path-based ops ==================== |
| 484 | |
| 485 | readdir(path, options) { |
| 486 | const promise = vfsOp(path, (vfs, n) => vfs.promises.readdir(n, options)); |
| 487 | if (promise !== undefined && options?.encoding === 'buffer' && !options?.withFileTypes) { |
| 488 | return promise.then((result) => { |
| 489 | for (let i = 0; i < result.length; i++) { |
| 490 | if (typeof result[i] === 'string') result[i] = Buffer.from(result[i]); |
| 491 | } |
| 492 | return result; |
| 493 | }); |
| 494 | } |
| 495 | return promise; |
| 496 | }, |
| 497 | lstat(path, options) { |
| 498 | const pathStr = toPathStr(path); |
| 499 | if (pathStr === null) return undefined; |