MCPcopy Index your code
hub / github.com/nodejs/node / #checkAccessMode

Method #checkAccessMode

lib/internal/vfs/provider.js:472–486  ·  view source on GitHub ↗

* Checks access mode bits against file stats. * @param {string} path The path (for error messages) * @param {Stats} stats The file stats * @param {number} mode The requested access mode

(path, stats, mode)

Source from the content-addressed store, hash-verified

470 * @param {number} mode The requested access mode
471 */
472 #checkAccessMode(path, stats, mode) {
473 if (mode == null || mode === 0) return; // F_OK = 0, existence-only check
474
475 const fileMode = stats.mode & 0o777; // Permission bits
476 // Check owner permissions (simplified: treat VFS user as owner)
477 if ((mode & R_OK) !== 0 && (fileMode & 0o400) === 0) {
478 throw createEACCES('access', path);
479 }
480 if ((mode & W_OK) !== 0 && (fileMode & 0o200) === 0) {
481 throw createEACCES('access', path);
482 }
483 if ((mode & X_OK) !== 0 && (fileMode & 0o100) === 0) {
484 throw createEACCES('access', path);
485 }
486 }
487
488 // === HARD LINK OPERATIONS (optional) ===
489

Callers 2

accessMethod · 0.95
accessSyncMethod · 0.95

Calls 1

createEACCESFunction · 0.85

Tested by

no test coverage detected