| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 325087b commit b17817e
50 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,7 @@ const { | |||
| 31 | 31 | getDirent, | |
| 32 | 32 | getOptions, | |
| 33 | 33 | getValidatedPath, | |
| 34 | + vfsState, | ||
| 34 | 35 | } = require('internal/fs/utils'); | |
| 35 | 36 | const { | |
| 36 | 37 | validateFunction, | |
@@ -330,6 +331,20 @@ function opendir(path, options, callback) { | |||
| 330 | 331 | callback = typeof options === 'function' ? options : callback; | |
| 331 | 332 | validateFunction(callback, 'callback'); | |
| 332 | 333 | ||
| 334 | + const h = vfsState.handlers; | ||
| 335 | + if (h !== null) { | ||
| 336 | + try { | ||
| 337 | + const result = h.opendirSync(path, options); | ||
| 338 | + if (result !== undefined) { | ||
| 339 | + process.nextTick(callback, null, result); | ||
| 340 | + return; | ||
| 341 | + } | ||
| 342 | + } catch (err) { | ||
| 343 | + process.nextTick(callback, err); | ||
| 344 | + return; | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + | ||
| 333 | 348 | path = getValidatedPath(path); | |
| 334 | 349 | options = getOptions(options, { | |
| 335 | 350 | encoding: 'utf8', | |
@@ -354,6 +369,12 @@ function opendir(path, options, callback) { | |||
| 354 | 369 | } | |
| 355 | 370 | ||
| 356 | 371 | function opendirSync(path, options) { | |
| 372 | + const h = vfsState.handlers; | ||
| 373 | + if (h !== null) { | ||
| 374 | + const result = h.opendirSync(path, options); | ||
| 375 | + if (result !== undefined) return result; | ||
| 376 | + } | ||
| 377 | + | ||
| 357 | 378 | path = getValidatedPath(path); | |
| 358 | 379 | options = getOptions(options, { encoding: 'utf8' }); | |
| 359 | 380 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments