Team Ai
Datasetpublic

codekingpro/portable-devtools

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