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

Function readFile

lib/internal/vfs/setup.js:519–532  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

517 return promise;
518 },
519 readFile(path, options) {
520 if (typeof path === 'number') {
521 const vfd = getVirtualFd(path);
522 if (vfd) {
523 const enc = typeof options === 'string' ? options : options?.encoding;
524 if (enc && enc !== 'buffer') assertEncoding(enc);
525 return vfd.entry.readFile(options);
526 }
527 return undefined;
528 }
529 const enc = typeof options === 'string' ? options : options?.encoding;
530 if (enc && enc !== 'buffer') assertEncoding(enc);
531 return vfsOp(path, (vfs, n) => vfs.promises.readFile(n, options));
532 },
533 realpath(path, options) {
534 const promise = vfsOp(path, (vfs, n) => vfs.promises.realpath(n, options));
535 if (promise !== undefined && options?.encoding === 'buffer') {

Callers

nothing calls this directly

Calls 4

getVirtualFdFunction · 0.85
assertEncodingFunction · 0.85
vfsOpFunction · 0.85
readFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…