Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bahamas10/node-perms
Convert Unix style permissions to strings like ls (0755 => 'rwxr-xr-x')
https://github.com/bahamas10/node-perms
Last synced: about 2 months ago
JSON representation
Convert Unix style permissions to strings like ls (0755 => 'rwxr-xr-x')
- Host: GitHub
- URL: https://github.com/bahamas10/node-perms
- Owner: bahamas10
- Created: 2012-09-15T04:57:39.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-28T21:05:06.000Z (over 9 years ago)
- Last Synced: 2024-05-08T20:00:54.994Z (8 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
perms
=====Convert Unix style permissions to strings like ls (0755 => 'rwxr-xr-x')
Usage
-----Node.js
``` js
var Perms = require('perms');
```Web
``` html
```
Examples
--------Convert a mode to a human-readable string like `ls(1)` generates
``` js
var p = Perms.toString(0755);
console.log(p);
```yields
```
rwxr-xr-x
```Also handles special permissions
``` js
var p = Perms.toString(6660);
console.log(p);
```yields
```
rwSrwS---
```Go backwards as well!
``` js
var mode = Perms.toMode('rwxr-xr-t');
console.log(mode);
```yields
```
1755
```*NOTE*: This module makes it super tempting to parse ls(1)... don't do that!
http://mywiki.wooledge.org/ParsingLs
Functions
---------### toMode(s)
Given a string, return the mode suitable for passing to `fs.chmod`
### toString(s)
Given a mode (as an int), return a string suitable for printing to a user
Installation
------------npm install perms
Tests
-----npm test
License
-------MIT License