Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
mode-fix.js29 linesDownload Raw Back to commonjs
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.modeFix = void 0;
4const modeFix = (mode, isDir, portable) => {
5    mode &= 0o7777;
6    // in portable mode, use the minimum reasonable umask
7    // if this system creates files with 0o664 by default
8    // (as some linux distros do), then we'll write the
9    // archive with 0o644 instead.  Also, don't ever create
10    // a file that is not readable/writable by the owner.
11    if (portable) {
12        mode = (mode | 0o600) & ~0o22;
13    }
14    // if dirs are readable, then they should be listable
15    if (isDir) {
16        if (mode & 0o400) {
17            mode |= 0o100;
18        }
19        if (mode & 0o40) {
20            mode |= 0o10;
21        }
22        if (mode & 0o4) {
23            mode |= 0o1;
24        }
25    }
26    return mode;
27};
28exports.modeFix = modeFix;
29//# sourceMappingURL=mode-fix.js.map
codekingpro/portable-devtools · Team Ai