Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
619 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict'
|
---|
| 2 | module.exports = (mode, isDir, portable) => {
|
---|
| 3 | mode &= 0o7777
|
---|
| 4 |
|
---|
| 5 | // in portable mode, use the minimum reasonable umask
|
---|
| 6 | // if this system creates files with 0o664 by default
|
---|
| 7 | // (as some linux distros do), then we'll write the
|
---|
| 8 | // archive with 0o644 instead. Also, don't ever create
|
---|
| 9 | // a file that is not readable/writable by the owner.
|
---|
| 10 | if (portable)
|
---|
| 11 | mode = (mode | 0o600) & ~0o22
|
---|
| 12 |
|
---|
| 13 | // if dirs are readable, then they should be listable
|
---|
| 14 | if (isDir) {
|
---|
| 15 | if (mode & 0o400)
|
---|
| 16 | mode |= 0o100
|
---|
| 17 | if (mode & 0o40)
|
---|
| 18 | mode |= 0o10
|
---|
| 19 | if (mode & 0o4)
|
---|
| 20 | mode |= 0o1
|
---|
| 21 | }
|
---|
| 22 | return mode
|
---|
| 23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.