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

Function readFile

lib/internal/fs/promises.js:2133–2151  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

2131}
2132
2133async function readFile(path, options) {
2134 const h = vfsState.handlers;
2135 if (h !== null) {
2136 checkAborted(options?.signal);
2137 const result = h.readFile(path, options);
2138 if (result !== undefined) return result;
2139 }
2140 options = getOptions(options, { flag: 'r' });
2141 validateReadFileBufferOptions(options);
2142 const flag = options.flag || 'r';
2143
2144 if (path instanceof FileHandle)
2145 return readFileHandle(path, options);
2146
2147 checkAborted(options.signal);
2148
2149 const fd = await open(path, flag, 0o666);
2150 return handleFdClose(readFileHandle(fd, options), fd.close);
2151}
2152
2153async function* _watch(filename, options = kEmptyObject) {
2154 const h = vfsState.handlers;

Callers 5

loadFunction · 0.90
loadFunction · 0.90
loadFunction · 0.90

Calls 6

readFileHandleFunction · 0.85
handleFdCloseFunction · 0.85
checkAbortedFunction · 0.70
getOptionsFunction · 0.70
openFunction · 0.70
readFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…