{"name":"stat-mode","version":"0.0.1","description":"Offers convenient getters and setters for the stat `mode`","main":"index.js","scripts":{"test":"mocha --reporter spec"},"repository":{"type":"git","url":"git://github.com/TooTallNate/stat-mode.git"},"keywords":["stat","mode","owner","group","others"],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io/"},"license":"MIT","bugs":{"url":"https://github.com/TooTallNate/stat-mode/issues"},"homepage":"https://github.com/TooTallNate/stat-mode","_id":"stat-mode@0.0.1","dist":{"shasum":"6f8b1d46f007c78775d341de35fc7a1c1003dff3","tarball":"http://registry-npm.ywwl.com/stat-mode/download/stat-mode-0.0.1.tgz","integrity":"sha512-o5PDkl9t5e/rvJ8jD90t3W4CD1DI3sh3zgzJTEkAPduy5emEg856xU6QCvpypAK4JgxW0uDjgf6ThsHUz/Vhdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFYaFYmPFKdgwIAWS6IZMvMCGWrPzonjHeR/IvNpYDTvAiA3nx1U85ASImanIU0mDcYMm6+XOjjcvnDhut0qlxMOxQ=="}],"size":2479,"noattachment":false,"key":"/stat-mode/-/stat-mode-0.0.1.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"directories":{},"readme":"stat-mode\n=========\n### Offers convenient getters and setters for the stat `mode`\n[![Build Status](https://github.com/TooTallNate/stat-mode/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/stat-mode/actions?workflow=Node+CI)\n\nYou know that `mode` property on the `fs.Stat` object that you probably\nusually just ignore? Well there's acutally a lot of information packed\ninto that number.\n\nThe specific information includes:\n\n * What the [\"file type\"](http://en.wikipedia.org/wiki/Unix_file_types) of file it is\n * Whether or not the [`setuid` and `setgid` bits](http://en.wikipedia.org/wiki/Setuid) are set\n * Whether or not the [`sticky` bit](http://en.wikipedia.org/wiki/Sticky_bit) is set\n * The [_read_, _write_, and _execute_ permissions for the _owner_, _group_ and _others_](http://en.wikipedia.org/wiki/File_system_permissions)\n\nThis module helps you extract that information.\n\nAll the getters are also setters, which change the `mode` property\nappropriately. This is useful for when you have to build up your\nown `fs.Stat` object for whatever reason (like when implementing a\nFUSE filesystem.\n\n\nInstallation\n------------\n\n``` bash\n$ npm install stat-mode\n```\n\n\nExample\n-------\n\nSo given some arbitrary file (let's say `/bin/echo`):\n\n``` bash\n$ ls -l /bin/echo\n-rwxr-xr-x 1 root wheel 14128 Aug 11  2013 /bin/echo\n```\n\nWe can inspect it using the `fs.stat()` call and creating a `Mode` instance\non top of it.\n\n``` javascript\nvar fs = require('fs');\nvar Mode = require('stat-mode');\n\nfs.stat('/bin/echo', function (err, stat) {\n  if (err) throw err;\n\n  // create a \"Mode\" instance on top of the `stat` object\n  var mode = new Mode(stat);\n\n  // you can check what kind of file it is:\n  mode.isDirectory();\n  // false\n\n  mode.isFIFO();\n  // false\n\n  mode.isFile();\n  // true\n\n\n  // and you can also check individual owner, group and others permissions\n  mode.owner.read;\n  // true\n\n  mode.owner.write;\n  // true\n\n  mode.owner.execute;\n  // true\n\n  mode.group.read;\n  // true\n\n  mode.group.write;\n  // false\n\n  mode.group.execute;\n  // true\n\n  mode.others.read;\n  // true\n\n  mode.others.write;\n  // false\n\n  mode.others.execute;\n  // true\n\n\n  // the `toString()` output resembes the `ls -l` output:\n  mode.toString();\n  // '-rwxr-xr-x'\n});\n```\n\n\nAPI\n---\n\n### new Mode(Object stat) → Mode\n\nYou must pass in \"stat\" object to the `Mode` constructor. The \"stat\"\nobject can be a real `fs.Stat` instance, or really any Object with a\n`mode` property.\n\n#### mode.isDirectory([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"directory\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"directory\".\n\n#### mode.isFile([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"file\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"file\".\n\n#### mode.isBlockDevice([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"block device\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"block device\".\n\n#### mode.isCharacterDevice([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"character device\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"character\ndevice\".\n\n#### mode.isSymbolicLink([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"symbolic link\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"symbolic link\".\n\n#### mode.isFIFO([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"FIFO\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"FIFO\".\n\n#### mode.isSocket([Boolean set]) → Boolean\n\nReturns `true` if the mode's file type is \"socket\", `false` otherwise.\nIf you pass `true` to the function, then the mode will be set to \"socket\".\n\n#### mode.owner.read → Boolean [Getter/Setter]\n\n`true` if the mode is \"owner read\" rights, `false` otherwise.\n\n#### mode.owner.write → Boolean [Getter/Setter]\n\n`true` if the mode is \"owner write\" rights, `false` otherwise.\n\n#### mode.owner.execute → Boolean [Getter/Setter]\n\n`true` if the mode is \"owner execute\" rights, `false` otherwise.\n\n#### mode.group.read → Boolean [Getter/Setter]\n\n`true` if the mode is \"group read\" rights, `false` otherwise.\n\n#### mode.group.write → Boolean [Getter/Setter]\n\n`true` if the mode is \"group write\" rights, `false` otherwise.\n\n#### mode.group.execute → Boolean [Getter/Setter]\n\n`true` if the mode is \"group execute\" rights, `false` otherwise.\n\n#### mode.others.read → Boolean [Getter/Setter]\n\n`true` if the mode is \"others read\" rights, `false` otherwise.\n\n#### mode.others.write → Boolean [Getter/Setter]\n\n`true` if the mode is \"others write\" rights, `false` otherwise.\n\n#### mode.others.execute → Boolean [Getter/Setter]\n\n`true` if the mode is \"others execute\" rights, `false` otherwise.\n","publish_time":1393710289572,"_cnpm_publish_time":1393710289572,"dist-tags":{"latest":"1.0.0"}}