MCPcopy Index your code
hub / github.com/nodejs/node / getDirent

Function getDirent

lib/internal/fs/utils.js:297–324  ·  view source on GitHub ↗
(path, name, type, callback)

Source from the content-addressed store, hash-verified

295}
296
297function getDirent(path, name, type, callback) {
298 if (typeof callback === 'function') {
299 if (type === UV_DIRENT_UNKNOWN) {
300 let filepath;
301 try {
302 filepath = join(path, name);
303 } catch (err) {
304 callback(err);
305 return;
306 }
307 lazyLoadFs().lstat(filepath, (err, stats) => {
308 if (err) {
309 callback(err);
310 return;
311 }
312 callback(null, new DirentFromStats(name, stats, path));
313 });
314 } else {
315 callback(null, new Dirent(name, type, path));
316 }
317 } else if (type === UV_DIRENT_UNKNOWN) {
318 const filepath = join(path, name);
319 const stats = lazyLoadFs().lstatSync(filepath);
320 return new DirentFromStats(name, stats, path);
321 } else {
322 return new Dirent(name, type, path);
323 }
324}
325
326function getOptions(options, defaultOptions = kEmptyObject) {
327 if (options == null || typeof options === 'function') {

Callers 1

getDirentsFunction · 0.70

Calls 5

lazyLoadFsFunction · 0.85
joinFunction · 0.70
callbackFunction · 0.50
lstatMethod · 0.45
lstatSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…