You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mode-fix.js 649B

123456789101112131415161718192021222324252627
  1. 'use strict'
  2. module.exports = (mode, isDir, portable) => {
  3. mode &= 0o7777
  4. // in portable mode, use the minimum reasonable umask
  5. // if this system creates files with 0o664 by default
  6. // (as some linux distros do), then we'll write the
  7. // archive with 0o644 instead. Also, don't ever create
  8. // a file that is not readable/writable by the owner.
  9. if (portable) {
  10. mode = (mode | 0o600) & ~0o22
  11. }
  12. // if dirs are readable, then they should be listable
  13. if (isDir) {
  14. if (mode & 0o400) {
  15. mode |= 0o100
  16. }
  17. if (mode & 0o40) {
  18. mode |= 0o10
  19. }
  20. if (mode & 0o4) {
  21. mode |= 0o1
  22. }
  23. }
  24. return mode
  25. }