# filepermissions

Dark Mode

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs

Search:

# Imports

os

# Funcs

    func toFilePermissions(perm: Natural): set[FilePermission] {...}{.raises: [],
        tags: [].}

  Convenience func to convert Unix like file permission to `set[FilePermission]`.

  See also:

  - getFilePermissions
  - setFilePermissions

  Example:

      import os
      doAssert toFilePermissions(0o700) == {fpUserExec, fpUserRead, fpUserWrite}
      doAssert toFilePermissions(0o070) == {fpGroupExec, fpGroupRead, fpGroupWrite}
      doAssert toFilePermissions(0o007) == {fpOthersExec, fpOthersRead, fpOthersWrite}
      doAssert toFilePermissions(0o644) == {fpUserWrite, fpUserRead, fpGroupRead, fpOthersRead}
      doAssert toFilePermissions(0o777) == {fpUserExec, fpUserWrite, fpUserRead, fpGroupExec, fpGroupWrite, fpGroupRead, fpOthersExec, fpOthersWrite, fpOthersRead}
      doAssert toFilePermissions(0o000) == {}

  Source Edit