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

Method readFileSync

lib/internal/vfs/provider.js:263–272  ·  view source on GitHub ↗

* Reads a file synchronously. * @param {string} path The file path * @param {object|string} [options] Options or encoding * @returns {Buffer|string}

(path, options)

Source from the content-addressed store, hash-verified

261 * @returns {Buffer|string}
262 */
263 readFileSync(path, options) {
264 const flag = (typeof options === 'object' && options !== null) ?
265 (options.flag ?? 'r') : 'r';
266 const handle = this.openSync(path, flag);
267 try {
268 return handle.readFileSync(options);
269 } finally {
270 handle.closeSync();
271 }
272 }
273
274 /**
275 * Writes a file.

Callers 15

copyFileSyncMethod · 0.95
defineDefaultCommandsFunction · 0.45
readFileSyncFunction · 0.45
readFunction · 0.45
loadPackageMapFunction · 0.45
getSourceSyncFunction · 0.45
defaultLoadImplFunction · 0.45
readFileSyncFunction · 0.45

Calls 2

openSyncMethod · 0.95
closeSyncMethod · 0.45

Tested by

no test coverage detected