VibeHunt
Back to browse

unix-permissions

Swiss Army knife for Unix permissions.

Source

The library provides a flexible way to work with Unix file‑system permissions in JavaScript and via a command‑line interface. It accepts the three common permission notations—symbolic (e.g., `ug+rw`), octal (e.g., `660`), and character lists (e.g., `drw-rw----`)—and can convert between them, allowing developers to choose the format that best fits their workflow.

Functions include testing whether a permission set contains another, setting and unsetting bits, validating syntax, normalizing expressions (such as collapsing `u+r,u+w` to `u+rw`), inverting masks (useful for umask calculations), and determining minimal or maximal permissions across multiple entries. All operations are performed on permission strings rather than on file paths, so external tools like `chmod` or `stat` are still required to apply changes to the filesystem.

The package runs in Node.js ≥ 18.18.0 and in browsers as an ES module, with TypeScript typings available. It can be installed from npm and used either programmatically via `import { convert } from 'unix-permissions'` or from the shell with the provided CLI commands.

Reviews

Sign in to leave a review.

Loading reviews…

Similar apps