perms - Node Module
Posted by Dave Eddy on Sep 25 2012 - tags: techConvert Unix style permissions to strings like ls (0755 => ‘rwxr-xr-x’)
I wrote this module to make it easy to print out nice looking permissions
in my scripts before calling fs.chmod
for the user.
Examples
Given
Convert a mode to a human-readable string like ls(1) generates
yields
rwxr-xr-x
Also handles special permissions
yields
rwSrwS---
Go backwards as well!
yields
1755
NOTE: This module makes it super tempting to parse ls(1)… don’t do that!
http://mywiki.wooledge.org/ParsingLs
Usage
Functions
toMode(s)
Given a string, return the mode suitable for passing to fs.chmod
toString(s)
Given a mode, return a string suitable for printing to a user
Installation
npm install perms
Tests
npm test