{"_id":"umask","_rev":"141190","name":"umask","description":"convert umask from string <-> number","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"isaacs","email":""},{"name":"othiym23","email":"ogd@aoaioxxysz.net"},{"name":"smikes","email":"smikes@cubane.com"}],"time":{"modified":"2021-06-03T11:27:01.000Z","created":"2015-01-15T03:06:07.758Z","1.1.0":"2015-01-15T12:47:12.246Z","1.0.0":"2015-01-15T03:06:07.758Z"},"users":{"mattmcfarland":true},"author":{"name":"Sam Mikes","email":"smikes@cubane.com"},"repository":{"type":"git","url":"https://github.com/smikes/umask.git"},"versions":{"1.1.0":{"name":"umask","version":"1.1.0","description":"convert umask from string <-> number","main":"index.js","scripts":{"test":"lab -ct 100","lint":"jslint --terse --latest *.js test/*.js"},"repository":{"type":"git","url":"https://github.com/smikes/umask.git"},"keywords":["umask"],"author":{"name":"Sam Mikes","email":"smikes@cubane.com"},"license":"MIT","bugs":{"url":"https://github.com/smikes/umask/issues"},"homepage":"https://github.com/smikes/umask","devDependencies":{"code":"^1.2.1","jslint":"^0.7.2","lab":"^5.2.0"},"gitHead":"63d821e4d0b06ef9a4b727c5fbe5976e9534d76e","_id":"umask@1.1.0","_shasum":"f29cebf01df517912bb58ff9c4e50fde8e33320d","_from":".","_npmVersion":"2.2.0","_nodeVersion":"0.10.35","_npmUser":{"name":"smikes","email":"smikes@cubane.com"},"maintainers":[{"name":"isaacs","email":""},{"name":"othiym23","email":"ogd@aoaioxxysz.net"},{"name":"smikes","email":"smikes@cubane.com"}],"dist":{"shasum":"f29cebf01df517912bb58ff9c4e50fde8e33320d","size":4132,"noattachment":false,"key":"/umask/-/umask-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/umask/download/umask-1.1.0.tgz"},"directories":{},"publish_time":1421326032246,"_cnpm_publish_time":1421326032246,"_hasShrinkwrap":false},"1.0.0":{"name":"umask","version":"1.0.0","description":"convert umask from string <-> number","main":"index.js","scripts":{"test":"lab -ct 100","lint":"jslint --terse --latest *.js test/*.js"},"repository":{"type":"git","url":"https://github.com/smikes/umask.git"},"keywords":["umask"],"author":{"name":"Sam Mikes","email":"smikes@cubane.com"},"license":"MIT","bugs":{"url":"https://github.com/smikes/umask/issues"},"homepage":"https://github.com/smikes/umask","devDependencies":{"code":"^1.2.1","jslint":"^0.7.2","lab":"^5.2.0"},"gitHead":"c619971253c3cfc97a8d876575dd1a97b8210897","_id":"umask@1.0.0","_shasum":"e6ba9ef654cebc90f91290b661f196db9932d11f","_from":".","_npmVersion":"2.2.0","_nodeVersion":"0.10.35","_npmUser":{"name":"smikes","email":"smikes@cubane.com"},"maintainers":[{"name":"isaacs","email":""},{"name":"othiym23","email":"ogd@aoaioxxysz.net"},{"name":"smikes","email":"smikes@cubane.com"}],"dist":{"shasum":"e6ba9ef654cebc90f91290b661f196db9932d11f","size":3138,"noattachment":false,"key":"/umask/-/umask-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/umask/download/umask-1.0.0.tgz"},"directories":{},"publish_time":1421291167758,"_cnpm_publish_time":1421291167758,"_hasShrinkwrap":false}},"readme":"# umask\n\nConvert umask from string &lt;-> number.\n\n## Installation & Use\n\n```\n$ npm install -S umask\n\nvar umask = require('umask');\n\nconsole.log(umask.toString(18));        // 0022\n\nconsole.log(umask.fromString('0777'))   // 511\n```\n\n## API\n\n### `toString( val )`\n\nConverts `val` to a 0-padded octal string.  `val` is assumed to be a\nNumber in the correct range (0..511)\n\n### `fromString( val, [cb] )`\n\nConverts `val` to a Number that can be used as a umask.  `val` can\nbe of the following forms:\n\n  * String containing octal number (leading 0)\n  * String containing decimal number\n  * Number\n\nIn all cases above, the value obtained is then converted to an integer and\nchecked against the legal `umask` range 0..511\n\n`fromString` can be used as a simple converter, with no error feedback, by\nomitting the optional callback argument `cb`:\n\n```\n   var mask = umask.fromString(val);\n\n   // mask is now the umask descibed by val or\n   // the default, 0022 (18 dec)\n```\n\nThe callback arguments are `(err, val)` where `err` is either `null` or an\nError object and `val` is either the converted umask or the default umask, `0022`.\n\n```\n   umask.fromString(val, function (err, val) {\n       if (err) {\n          console.error(\"invalid umask: \" + err.message)\n       }\n\n       /* do something with val */\n   });\n```\n\nThe callback, if provided, is always called **synchronously**.\n\n### `validate( data, k, val )`\n\nThis is a validation function of the form expected by `nopt`.  If\n`val` is a valid umask, the function returns true and sets `data[k]`.\nIf `val` is not a valid umask, the function returns false.\n\nThe `validate` function is stricter than `fromString`: it only accepts\nNumber or octal String values, and the String value must begin with `0`.\nThe `validate` function does **not** accept Strings containing decimal\nnumbers.\n\n# Maintainer\n\nSam Mikes <smikes@cubane.com>\n\n# License\n\nMIT","_attachments":{},"homepage":"https://github.com/smikes/umask","bugs":{"url":"https://github.com/smikes/umask/issues"},"license":"MIT"}