How to use the unix-permissions.positive function in unix-permissions

To help you get started, we’ve selected a few unix-permissions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ehmicky / unix-permissions / examples / methods / positive.js View on Github external
'use strict'

// Ignore the following line: this is only needed for internal purposes.
require('../utils.js')

const { positive, invert } = require('unix-permissions')

console.log(positive('o+x,o-rw')) // 'o+x'

console.log(positive('o=x')) // 'o+x'

console.log(positive('660')) // '+0660'

console.log(invert('660')) // '0117'

console.log(invert(positive('660'))) // '-0660'
github ehmicky / unix-permissions / examples / methods / convert.js View on Github external
// This file can be directly run:
//   - first install `unix-permissions`
//   - then `node node_modules/unix-permissions/examples/methods/convert.js`
// An online demo is also available at:
//   https://repl.it/@ehmicky/unix-permissions

'use strict'

// Ignore the following line: this is only needed for internal purposes.
require('../utils.js')

const { convert, positive } = require('unix-permissions')

console.log(convert.symbolic('111')) // 'a=x'

console.log(positive(convert.symbolic('111'))) // 'a+x'

console.log(convert.octal('o+x')) // '+0001'

console.log(convert.octal('o=x')) // '0001'

try {
  convert.octal('z+x') // Throws an exception (permission syntax is invalid)
} catch (error) {
  console.log(error.message)
}
github ehmicky / unix-permissions / examples / methods / positive.js View on Github external
//   - then `node node_modules/unix-permissions/examples/methods/positive.js`
// An online demo is also available at:
//   https://repl.it/@ehmicky/unix-permissions

'use strict'

// Ignore the following line: this is only needed for internal purposes.
require('../utils.js')

const { positive, invert } = require('unix-permissions')

console.log(positive('o+x,o-rw')) // 'o+x'

console.log(positive('o=x')) // 'o+x'

console.log(positive('660')) // '+0660'

console.log(invert('660')) // '0117'

console.log(invert(positive('660'))) // '-0660'
github ehmicky / unix-permissions / examples / methods / positive.js View on Github external
// This file can be directly run:
//   - first install `unix-permissions`
//   - then `node node_modules/unix-permissions/examples/methods/positive.js`
// An online demo is also available at:
//   https://repl.it/@ehmicky/unix-permissions

'use strict'

// Ignore the following line: this is only needed for internal purposes.
require('../utils.js')

const { positive, invert } = require('unix-permissions')

console.log(positive('o+x,o-rw')) // 'o+x'

console.log(positive('o=x')) // 'o+x'

console.log(positive('660')) // '+0660'

console.log(invert('660')) // '0117'

console.log(invert(positive('660'))) // '-0660'
github ehmicky / unix-permissions / examples / methods / positive.js View on Github external
// Demo of the `positive()` method in JavaScript.
// This file can be directly run:
//   - first install `unix-permissions`
//   - then `node node_modules/unix-permissions/examples/methods/positive.js`
// An online demo is also available at:
//   https://repl.it/@ehmicky/unix-permissions

'use strict'

// Ignore the following line: this is only needed for internal purposes.
require('../utils.js')

const { positive, invert } = require('unix-permissions')

console.log(positive('o+x,o-rw')) // 'o+x'

console.log(positive('o=x')) // 'o+x'

console.log(positive('660')) // '+0660'

console.log(invert('660')) // '0117'

console.log(invert(positive('660'))) // '-0660'