(path, options)
| 188 | return r !== null ? r.exists : undefined; |
| 189 | }, |
| 190 | readFileSync(path, options) { |
| 191 | if (typeof path === 'number') { |
| 192 | const vfd = getVirtualFd(path); |
| 193 | if (vfd) { |
| 194 | const enc = typeof options === 'string' ? options : options?.encoding; |
| 195 | if (enc && enc !== 'buffer') assertEncoding(enc); |
| 196 | return vfd.entry.readFileSync(options); |
| 197 | } |
| 198 | return undefined; |
| 199 | } |
| 200 | const pathStr = toPathStr(path); |
| 201 | if (pathStr === null) return undefined; |
| 202 | const enc = typeof options === 'string' ? options : options?.encoding; |
| 203 | if (enc && enc !== 'buffer') assertEncoding(enc); |
| 204 | return findVFSWith(pathStr, 'open', (vfs, n) => vfs.readFileSync(n, options)); |
| 205 | }, |
| 206 | readdirSync(path, options) { |
| 207 | const result = vfsRead(path, 'scandir', (vfs, n) => vfs.readdirSync(n, options)); |
| 208 | if (result !== undefined && options?.encoding === 'buffer' && !options?.withFileTypes) { |
no test coverage detected
searching dependent graphs…