umask

WebJar for umask

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

umask
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

umask
WebJar for umask
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/smikes/umask

Скачать umask

Имя Файла Размер
umask-1.1.0.pom
umask-1.1.0.jar 8 KB
umask-1.1.0-sources.jar 22 bytes
umask-1.1.0-javadoc.jar 22 bytes
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/umask/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>umask</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/umask/
implementation 'org.webjars.npm:umask:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/umask/
implementation ("org.webjars.npm:umask:1.1.0")
'org.webjars.npm:umask:jar:1.1.0'
<dependency org="org.webjars.npm" name="umask" rev="1.1.0">
  <artifact name="umask" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='umask', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "umask" % "1.1.0"
[org.webjars.npm/umask "1.1.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

umask

Convert umask from string <-> number.

Installation & Use

$ npm install -S umask

var umask = require('umask');

console.log(umask.toString(18));        // 0022

console.log(umask.fromString('0777'))   // 511

API

toString( val )

Converts val to a 0-padded octal string. val is assumed to be a Number in the correct range (0..511)

fromString( val, [cb] )

Converts val to a Number that can be used as a umask. val can be of the following forms:

  • String containing octal number (leading 0)
  • String containing decimal number
  • Number

In all cases above, the value obtained is then converted to an integer and checked against the legal umask range 0..511

fromString can be used as a simple converter, with no error feedback, by omitting the optional callback argument cb:

   var mask = umask.fromString(val);

   // mask is now the umask descibed by val or
   // the default, 0022 (18 dec)

The callback arguments are (err, val) where err is either null or an Error object and val is either the converted umask or the default umask, 0022.

   umask.fromString(val, function (err, val) {
       if (err) {
          console.error("invalid umask: " + err.message)
       }

       /* do something with val */
   });

The callback, if provided, is always called synchronously.

validate( data, k, val )

This is a validation function of the form expected by nopt. If val is a valid umask, the function returns true and sets data[k]. If val is not a valid umask, the function returns false.

The validate function is stricter than fromString: it only accepts Number or octal String values, and the String value must begin with 0. The validate function does not accept Strings containing decimal numbers.

Maintainer

Sam Mikes smikes@cubane.com

License

MIT

Версии библиотеки

Версия
1.1.0