(path, options)
| 1690 | } |
| 1691 | |
| 1692 | async function readdir(path, options) { |
| 1693 | const h = vfsState.handlers; |
| 1694 | if (h !== null) { |
| 1695 | const promise = h.readdir(path, options); |
| 1696 | if (promise !== undefined) return await promise; |
| 1697 | } |
| 1698 | options = getOptions(options); |
| 1699 | |
| 1700 | // Make shallow copy to prevent mutating options from affecting results |
| 1701 | options = copyObject(options); |
| 1702 | |
| 1703 | path = getValidatedPath(path); |
| 1704 | if (options.recursive) { |
| 1705 | return readdirRecursive(path, options); |
| 1706 | } |
| 1707 | const result = await PromisePrototypeThen( |
| 1708 | binding.readdir( |
| 1709 | path, |
| 1710 | options.encoding, |
| 1711 | !!options.withFileTypes, |
| 1712 | kUsePromises, |
| 1713 | ), |
| 1714 | undefined, |
| 1715 | handleErrorFromBinding, |
| 1716 | ); |
| 1717 | return options.withFileTypes ? |
| 1718 | getDirectoryEntriesPromise(path, result) : |
| 1719 | result; |
| 1720 | } |
| 1721 | |
| 1722 | async function readlink(path, options) { |
| 1723 | const h = vfsState.handlers; |
no test coverage detected
searching dependent graphs…