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

Function parseFileMode

lib/internal/validators.js:73–85  ·  view source on GitHub ↗

* Parse and validate values that will be converted into mode_t (the S_* * constants). Only valid numbers and octal strings are allowed. They could be * converted to 32-bit unsigned integers or non-negative signed integers in the * C++ land, but any value higher than 0o777 will result in platform-

(value, name, def)

Source from the content-addressed store, hash-verified

71 * @returns {number}
72 */
73function parseFileMode(value, name, def) {
74 value ??= def;
75 if (typeof value === 'string') {
76 if (RegExpPrototypeExec(octalReg, value) === null) {
77 throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);
78 }
79 value = NumberParseInt(value, 8);
80 }
81
82 validateUint32(value, name);
83 // Coerce -0 to +0.
84 return value + 0;
85}
86
87/**
88 * @callback validateInteger

Callers 15

openFunction · 0.85
openSyncFunction · 0.85
mkdirFunction · 0.85
mkdirSyncFunction · 0.85
fchmodFunction · 0.85
fchmodSyncFunction · 0.85
lchmodFunction · 0.85
chmodFunction · 0.85
chmodSyncFunction · 0.85
writeFileFunction · 0.85
writeFileSyncFunction · 0.85
appendFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…