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

Function open

lib/internal/fs/promises.js:1351–1365  ·  view source on GitHub ↗
(path, flags, mode)

Source from the content-addressed store, hash-verified

1349// Note that unlike fs.open() which uses numeric file descriptors,
1350// fsPromises.open() uses the fs.FileHandle class.
1351async function open(path, flags, mode) {
1352 const h = vfsState.handlers;
1353 if (h !== null) {
1354 const result = h.promisesOpen(path, flags, mode);
1355 if (result !== undefined) return result;
1356 }
1357 path = getValidatedPath(path);
1358 const flagsNumber = stringToFlags(flags);
1359 mode = parseFileMode(mode, 'mode', 0o666);
1360 return new FileHandle(await PromisePrototypeThen(
1361 binding.openFileHandle(path, flagsNumber, mode, kUsePromises),
1362 undefined,
1363 handleErrorFromBinding,
1364 ));
1365}
1366
1367async function read(handle, bufferOrParams, offset, length, position) {
1368 let buffer = bufferOrParams;

Callers

nothing calls this directly

Calls 2

stringToFlagsFunction · 0.85
parseFileModeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…