DEV Community

ehmicky
ehmicky

Posted on

Swiss Army knife for Unix permissions

Unix file permissions can take many shapes: symbolic (ug+rw), octal (660) or a list of characters (drw-rw----).

unix-permissions (https://github.com/ehmicky/unix-permissions) enables using any of these (instead of being limited to a single one) with any Node.js or CLI command.

This library can also perform operations on Unix permissions such as:

  • testing, setting and unsetting. Using bitwise operations (|, &, ^, ~) can be tedious and error-prone otherwise.
  • validating syntax.
  • normalizing. For example u+r,u+w can be shortened to u+rw.
  • inverting. For example a umask of 117 means new files will be created with 661 permissions.
  • checking the minimal or maximal permissions among a list of them. This can be useful to aggregate all the permissions of several files, e.g. during a directory recursion.

Feel free to provide me with feedback on dev.to or on GitHub!

Top comments (5)

Collapse
 
vznwjwn_mzmzbns_0d239e09d profile image
Vznwjwn Mzmzbns

This library is a game changer for managing Unix permissions! It’s so much easier to work with symbolic, octal, and character new squishmallows 2025 formats all in one place. The normalizing and inverting features are super useful for streamlining tasks. Definitely adding this to my dev toolkit!

Collapse
 
bfunbhd_chgjjggj_d72724e6 profile image
Bfunbhd Chgjjggj

This is seriously powerful—finally a clean way to handle all permission formats in one place. Saves so much time over manual bitwise grinchcostumes ops. The normalize and invert features are a game changer. Definitely adding this to my toolbelt for Node.js work!

Collapse
 
gjghnvt_stgrtgsrg_047f763 profile image
Gjghnvt Stgrtgsrg

Awesome library! Makes handling Unix permissions way less painful, especially with all the format flexibility. Love the normalize and morticia addams plus size costume invert features—they’re super handy. Definitely a must-use for any Node.js project dealing with file perms.

Collapse
 
bsnsisns_yerififje_171701 profile image
Bsnsisns Yerififje

This tool is super helpful, makes permission handling so much easier, especially with different formats. Love the normalize and Meiziz Keychain invert features, they saved me a ton of time. Works great with Node.js and CLI commands too. Big thanks for building and sharing this!

Collapse
 
aghabwhsh_bdheuwbdh_74fe6 profile image
Aghabwhsh Bdheuwbdh

This library looks super useful for handling Unix permissions in Node.js! I love that it supports symbolic, octal, and character-based permissions Army Job, making it flexible. The operations like validation and normalization will save a lot of time. I’ll definitely check it out!