chmod function

void chmod(
  1. String path, {
  2. required String permission,
})

Wrapper for the linux chmod command.

permission is an octal string as used by the cli commandchmod e.g. 777 path is the path to the file that we are changing the permissions of.

The permission digits are intrepeted as owner, group, other. So: 641 owner - 6 group - 4 other - 1

Each digit is the sum of the permissions: 4 - allow read 2 - allow write 1 - all execute

So 6 is 4 + 2 is read and write and from the above example gives the owner r/w permission.

To set give the owner execution privileges use:

chmod('/path/to/exe', '100');

If path doesn't exist a ChModException] is thrown.

On Windows a call to this method is a noop.

Implementation

void chmod(String path, {required String permission}) =>
    _ChMod()._chmod(path, permission);