Initial
This commit is contained in:
1
Client/node_modules/stat-mode/.npmignore
generated
vendored
Executable file
1
Client/node_modules/stat-mode/.npmignore
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
/node_modules
|
||||
27
Client/node_modules/stat-mode/.travis.yml
generated
vendored
Executable file
27
Client/node_modules/stat-mode/.travis.yml
generated
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "1"
|
||||
- "2"
|
||||
- "3"
|
||||
- "4"
|
||||
- "5"
|
||||
|
||||
install:
|
||||
- PATH="`npm bin`:`npm bin -g`:$PATH"
|
||||
# Node 0.8 comes with a too obsolete npm
|
||||
- if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi
|
||||
# Install dependencies and build
|
||||
- npm install
|
||||
|
||||
script:
|
||||
# Output useful info for debugging
|
||||
- node --version
|
||||
- npm --version
|
||||
# Run tests
|
||||
- npm test
|
||||
40
Client/node_modules/stat-mode/History.md
generated
vendored
Executable file
40
Client/node_modules/stat-mode/History.md
generated
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
0.2.2 / 2016-09-05
|
||||
==================
|
||||
|
||||
* [[`764f2420ef`](https://github.com/TooTallNate/stat-mode/commit/764f2420ef)] - Rename `define()` to `_define()` (#6) (CxRes)
|
||||
* [[`ba5a88d6e4`](https://github.com/TooTallNate/stat-mode/commit/ba5a88d6e4)] - **package**: update "mocha" to v3.0.2 (Nathan Rajlich)
|
||||
* [[`e8a4a487ab`](https://github.com/TooTallNate/stat-mode/commit/e8a4a487ab)] - **travis**: test lots more node versions (Nathan Rajlich)
|
||||
|
||||
0.2.1 / 2015-04-06
|
||||
==================
|
||||
|
||||
* fix #2
|
||||
* add regression test for #2
|
||||
* travis: test node v0.12 instead of v0.11
|
||||
* .travis: don't test node v0.9.x
|
||||
* add .travis.yml file
|
||||
* README: add Travis-CI badge
|
||||
* test: add FIFO test
|
||||
* test: more test cases
|
||||
* test: more inputs for tests
|
||||
* package: update "mocha" to v1.18.2
|
||||
* package: add a few more "keywords"
|
||||
|
||||
0.2.0 / 2014-04-02
|
||||
==================
|
||||
|
||||
* index: add `Mode#toOctal()` function
|
||||
* index: add `setuid`, `setgid` and `sticky` props
|
||||
* test: initial tests
|
||||
|
||||
0.1.0 / 2014-03-01
|
||||
==================
|
||||
|
||||
* package: remove the "test" script for now
|
||||
* index: add `Mode#toString()` function
|
||||
* index: add `Mode#valueOf()` function
|
||||
|
||||
0.0.1 / 2014-03-01
|
||||
==================
|
||||
|
||||
* initial commit
|
||||
182
Client/node_modules/stat-mode/README.md
generated
vendored
Executable file
182
Client/node_modules/stat-mode/README.md
generated
vendored
Executable file
@@ -0,0 +1,182 @@
|
||||
stat-mode
|
||||
=========
|
||||
### Offers convenient getters and setters for the stat `mode`
|
||||
[](https://travis-ci.org/TooTallNate/stat-mode)
|
||||
|
||||
You know that `mode` property on the `fs.Stat` object that you probably
|
||||
usually just ignore? Well there's acutally a lot of information packed
|
||||
into that number.
|
||||
|
||||
The specific information includes:
|
||||
|
||||
* What the ["file type"](http://en.wikipedia.org/wiki/Unix_file_types) of file it is
|
||||
* Whether or not the [`setuid` and `setgid` bits](http://en.wikipedia.org/wiki/Setuid) are set
|
||||
* Whether or not the [`sticky` bit](http://en.wikipedia.org/wiki/Sticky_bit) is set
|
||||
* The [_read_, _write_, and _execute_ permissions for the _owner_, _group_ and _others_](http://en.wikipedia.org/wiki/File_system_permissions)
|
||||
|
||||
This module helps you extract that information.
|
||||
|
||||
All the getters are also setters, which change the `mode` property
|
||||
appropriately. This is useful for when you have to build up your
|
||||
own `fs.Stat` object for whatever reason (like when implementing a
|
||||
FUSE filesystem.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
``` bash
|
||||
$ npm install stat-mode
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
So given some arbitrary file (let's say `/bin/echo`):
|
||||
|
||||
``` bash
|
||||
$ ls -l /bin/echo
|
||||
-rwxr-xr-x 1 root wheel 14128 Aug 11 2013 /bin/echo
|
||||
```
|
||||
|
||||
We can inspect it using the `fs.stat()` call and creating a `Mode` instance
|
||||
on top of it.
|
||||
|
||||
``` javascript
|
||||
var fs = require('fs');
|
||||
var Mode = require('stat-mode');
|
||||
|
||||
fs.stat('/bin/echo', function (err, stat) {
|
||||
if (err) throw err;
|
||||
|
||||
// create a "Mode" instance on top of the `stat` object
|
||||
var mode = new Mode(stat);
|
||||
|
||||
// you can check what kind of file it is:
|
||||
mode.isDirectory();
|
||||
// false
|
||||
|
||||
mode.isFIFO();
|
||||
// false
|
||||
|
||||
mode.isFile();
|
||||
// true
|
||||
|
||||
|
||||
// and you can also check individual owner, group and others permissions
|
||||
mode.owner.read;
|
||||
// true
|
||||
|
||||
mode.owner.write;
|
||||
// true
|
||||
|
||||
mode.owner.execute;
|
||||
// true
|
||||
|
||||
mode.group.read;
|
||||
// true
|
||||
|
||||
mode.group.write;
|
||||
// false
|
||||
|
||||
mode.group.execute;
|
||||
// true
|
||||
|
||||
mode.others.read;
|
||||
// true
|
||||
|
||||
mode.others.write;
|
||||
// false
|
||||
|
||||
mode.others.execute;
|
||||
// true
|
||||
|
||||
|
||||
// the `toString()` output resembes the `ls -l` output:
|
||||
mode.toString();
|
||||
// '-rwxr-xr-x'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
### new Mode(Object stat) → Mode
|
||||
|
||||
You must pass in "stat" object to the `Mode` constructor. The "stat"
|
||||
object can be a real `fs.Stat` instance, or really any Object with a
|
||||
`mode` property.
|
||||
|
||||
#### mode.isDirectory([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "directory", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "directory".
|
||||
|
||||
#### mode.isFile([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "file", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "file".
|
||||
|
||||
#### mode.isBlockDevice([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "block device", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "block device".
|
||||
|
||||
#### mode.isCharacterDevice([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "character device", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "character
|
||||
device".
|
||||
|
||||
#### mode.isSymbolicLink([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "symbolic link", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "symbolic link".
|
||||
|
||||
#### mode.isFIFO([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "FIFO", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "FIFO".
|
||||
|
||||
#### mode.isSocket([Boolean set]) → Boolean
|
||||
|
||||
Returns `true` if the mode's file type is "socket", `false` otherwise.
|
||||
If you pass `true` to the function, then the mode will be set to "socket".
|
||||
|
||||
#### mode.owner.read → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "owner read" rights, `false` otherwise.
|
||||
|
||||
#### mode.owner.write → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "owner write" rights, `false` otherwise.
|
||||
|
||||
#### mode.owner.execute → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "owner execute" rights, `false` otherwise.
|
||||
|
||||
#### mode.group.read → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "group read" rights, `false` otherwise.
|
||||
|
||||
#### mode.group.write → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "group write" rights, `false` otherwise.
|
||||
|
||||
#### mode.group.execute → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "group execute" rights, `false` otherwise.
|
||||
|
||||
#### mode.others.read → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "others read" rights, `false` otherwise.
|
||||
|
||||
#### mode.others.write → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "others write" rights, `false` otherwise.
|
||||
|
||||
#### mode.others.execute → Boolean [Getter/Setter]
|
||||
|
||||
`true` if the mode is "others execute" rights, `false` otherwise.
|
||||
337
Client/node_modules/stat-mode/index.js
generated
vendored
Executable file
337
Client/node_modules/stat-mode/index.js
generated
vendored
Executable file
@@ -0,0 +1,337 @@
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = Mode;
|
||||
|
||||
/**
|
||||
* Constants (defined in `stat.h`).
|
||||
*/
|
||||
|
||||
var S_IFMT = 61440; /* 0170000 type of file */
|
||||
var S_IFIFO = 4096; /* 0010000 named pipe (fifo) */
|
||||
var S_IFCHR = 8192; /* 0020000 character special */
|
||||
var S_IFDIR = 16384; /* 0040000 directory */
|
||||
var S_IFBLK = 24576; /* 0060000 block special */
|
||||
var S_IFREG = 32768; /* 0100000 regular */
|
||||
var S_IFLNK = 40960; /* 0120000 symbolic link */
|
||||
var S_IFSOCK = 49152; /* 0140000 socket */
|
||||
var S_IFWHT = 57344; /* 0160000 whiteout */
|
||||
var S_ISUID = 2048; /* 0004000 set user id on execution */
|
||||
var S_ISGID = 1024; /* 0002000 set group id on execution */
|
||||
var S_ISVTX = 512; /* 0001000 save swapped text even after use */
|
||||
var S_IRUSR = 256; /* 0000400 read permission, owner */
|
||||
var S_IWUSR = 128; /* 0000200 write permission, owner */
|
||||
var S_IXUSR = 64; /* 0000100 execute/search permission, owner */
|
||||
var S_IRGRP = 32; /* 0000040 read permission, group */
|
||||
var S_IWGRP = 16; /* 0000020 write permission, group */
|
||||
var S_IXGRP = 8; /* 0000010 execute/search permission, group */
|
||||
var S_IROTH = 4; /* 0000004 read permission, others */
|
||||
var S_IWOTH = 2; /* 0000002 write permission, others */
|
||||
var S_IXOTH = 1; /* 0000001 execute/search permission, others */
|
||||
|
||||
/**
|
||||
* `Mode` class.
|
||||
*
|
||||
* @param {fs.Stat} stat a "stat" object (anything with a `mode` Number property)
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Mode (stat) {
|
||||
if (!(this instanceof Mode)) return new Mode(stat);
|
||||
if (!stat) throw new TypeError('must pass in a "stat" object');
|
||||
if ('number' != typeof stat.mode) stat.mode = 0;
|
||||
this.stat = stat;
|
||||
this.owner = new Owner(stat);
|
||||
this.group = new Group(stat);
|
||||
this.others = new Others(stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Number value of the `mode`.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mode.prototype.valueOf = function () {
|
||||
return this.stat.mode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a String representation of the `mode`.
|
||||
* The output resembles something similiar to what `ls -l` would output.
|
||||
*
|
||||
* http://en.wikipedia.org/wiki/Unix_file_types
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mode.prototype.toString = function () {
|
||||
var str = [];
|
||||
|
||||
// file type
|
||||
if (this.isDirectory()) {
|
||||
str.push('d');
|
||||
} else if (this.isFile()) {
|
||||
str.push('-');
|
||||
} else if (this.isBlockDevice()) {
|
||||
str.push('b');
|
||||
} else if (this.isCharacterDevice()) {
|
||||
str.push('c');
|
||||
} else if (this.isSymbolicLink()) {
|
||||
str.push('l');
|
||||
} else if (this.isFIFO()) {
|
||||
str.push('p');
|
||||
} else if (this.isSocket()) {
|
||||
str.push('s');
|
||||
} else {
|
||||
throw new TypeError('unexpected "file type"');
|
||||
}
|
||||
|
||||
// owner read, write, execute
|
||||
str.push(this.owner.read ? 'r' : '-');
|
||||
str.push(this.owner.write ? 'w' : '-');
|
||||
if (this.setuid) {
|
||||
str.push(this.owner.execute ? 's' : 'S');
|
||||
} else {
|
||||
str.push(this.owner.execute ? 'x' : '-');
|
||||
}
|
||||
|
||||
// group read, write, execute
|
||||
str.push(this.group.read ? 'r' : '-');
|
||||
str.push(this.group.write ? 'w' : '-');
|
||||
if (this.setgid) {
|
||||
str.push(this.group.execute ? 's' : 'S');
|
||||
} else {
|
||||
str.push(this.group.execute ? 'x' : '-');
|
||||
}
|
||||
|
||||
// others read, write, execute
|
||||
str.push(this.others.read ? 'r' : '-');
|
||||
str.push(this.others.write ? 'w' : '-');
|
||||
if (this.sticky) {
|
||||
str.push(this.others.execute ? 't' : 'T');
|
||||
} else {
|
||||
str.push(this.others.execute ? 'x' : '-');
|
||||
}
|
||||
|
||||
return str.join('');
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an octal representation of the `mode`, eg. "0754".
|
||||
*
|
||||
* http://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Mode.prototype.toOctal = function () {
|
||||
var octal = this.stat.mode & 4095 /* 07777 */;
|
||||
return ('0000' + octal.toString(8)).slice(-4);
|
||||
};
|
||||
|
||||
Mode.prototype._checkModeProperty = function (property, set) {
|
||||
var mode = this.stat.mode;
|
||||
if (set) {
|
||||
this.stat.mode = (mode | S_IFMT) & property | mode & ~S_IFMT;
|
||||
}
|
||||
return (mode & S_IFMT) === property;
|
||||
};
|
||||
|
||||
Mode.prototype.isDirectory = function (v) {
|
||||
return this._checkModeProperty(S_IFDIR, v);
|
||||
};
|
||||
|
||||
Mode.prototype.isFile = function (v) {
|
||||
return this._checkModeProperty(S_IFREG, v);
|
||||
};
|
||||
|
||||
Mode.prototype.isBlockDevice = function (v) {
|
||||
return this._checkModeProperty(S_IFBLK, v);
|
||||
};
|
||||
|
||||
Mode.prototype.isCharacterDevice = function (v) {
|
||||
return this._checkModeProperty(S_IFCHR, v);
|
||||
};
|
||||
|
||||
Mode.prototype.isSymbolicLink = function (v) {
|
||||
return this._checkModeProperty(S_IFLNK, v);
|
||||
};
|
||||
|
||||
Mode.prototype.isFIFO = function (v) {
|
||||
return this._checkModeProperty(S_IFIFO, v);
|
||||
};
|
||||
|
||||
Mode.prototype.isSocket = function (v) {
|
||||
return this._checkModeProperty(S_IFSOCK, v);
|
||||
};
|
||||
|
||||
_define(Mode.prototype, 'setuid',
|
||||
function () {
|
||||
return Boolean(this.stat.mode & S_ISUID);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
this.stat.mode |= S_ISUID;
|
||||
} else {
|
||||
this.stat.mode &= ~S_ISUID;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
_define(Mode.prototype, 'setgid',
|
||||
function () {
|
||||
return Boolean(this.stat.mode & S_ISGID);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
this.stat.mode |= S_ISGID;
|
||||
} else {
|
||||
this.stat.mode &= ~S_ISGID;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
_define(Mode.prototype, 'sticky',
|
||||
function () {
|
||||
return Boolean(this.stat.mode & S_ISVTX);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
this.stat.mode |= S_ISVTX;
|
||||
} else {
|
||||
this.stat.mode &= ~S_ISVTX;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function Owner (stat) {
|
||||
_define(this, 'read',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IRUSR);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IRUSR;
|
||||
} else {
|
||||
stat.mode &= ~S_IRUSR;
|
||||
}
|
||||
}
|
||||
);
|
||||
_define(this, 'write',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IWUSR);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IWUSR;
|
||||
} else {
|
||||
stat.mode &= ~S_IWUSR;
|
||||
}
|
||||
}
|
||||
);
|
||||
_define(this, 'execute',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IXUSR);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IXUSR;
|
||||
} else {
|
||||
stat.mode &= ~S_IXUSR;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function Group (stat) {
|
||||
_define(this, 'read',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IRGRP);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IRGRP;
|
||||
} else {
|
||||
stat.mode &= ~S_IRGRP;
|
||||
}
|
||||
}
|
||||
);
|
||||
_define(this, 'write',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IWGRP);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IWGRP;
|
||||
} else {
|
||||
stat.mode &= ~S_IWGRP;
|
||||
}
|
||||
}
|
||||
);
|
||||
_define(this, 'execute',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IXGRP);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IXGRP;
|
||||
} else {
|
||||
stat.mode &= ~S_IXGRP;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function Others (stat) {
|
||||
_define(this, 'read',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IROTH);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IROTH;
|
||||
} else {
|
||||
stat.mode &= ~S_IROTH;
|
||||
}
|
||||
}
|
||||
);
|
||||
_define(this, 'write',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IWOTH);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IWOTH;
|
||||
} else {
|
||||
stat.mode &= ~S_IWOTH;
|
||||
}
|
||||
}
|
||||
);
|
||||
_define(this, 'execute',
|
||||
function () {
|
||||
return Boolean(stat.mode & S_IXOTH);
|
||||
},
|
||||
function (v) {
|
||||
if (v) {
|
||||
stat.mode |= S_IXOTH;
|
||||
} else {
|
||||
stat.mode &= ~S_IXOTH;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function _define (obj, name, get, set) {
|
||||
Object.defineProperty(obj, name, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: get,
|
||||
set: set
|
||||
});
|
||||
}
|
||||
62
Client/node_modules/stat-mode/package.json
generated
vendored
Executable file
62
Client/node_modules/stat-mode/package.json
generated
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "stat-mode@^0.2.0",
|
||||
"_id": "stat-mode@0.2.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-5sgLYjEj19gM8TLOU480YokHJQI=",
|
||||
"_location": "/stat-mode",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "stat-mode@^0.2.0",
|
||||
"name": "stat-mode",
|
||||
"escapedName": "stat-mode",
|
||||
"rawSpec": "^0.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-chmod"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-0.2.2.tgz",
|
||||
"_shasum": "e6c80b623123d7d80cf132ce538f346289072502",
|
||||
"_spec": "stat-mode@^0.2.0",
|
||||
"_where": "/home/nathan/Projects/Upsilon/UpsilonVsCodeLanguageServer/Client/node_modules/gulp-chmod",
|
||||
"author": {
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/stat-mode/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Offers convenient getters and setters for the stat `mode`",
|
||||
"devDependencies": {
|
||||
"mocha": "^3.0.2"
|
||||
},
|
||||
"homepage": "https://github.com/TooTallNate/stat-mode",
|
||||
"keywords": [
|
||||
"stat",
|
||||
"mode",
|
||||
"owner",
|
||||
"group",
|
||||
"others",
|
||||
"chmod",
|
||||
"octal",
|
||||
"symbolic",
|
||||
"permissions"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "stat-mode",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/stat-mode.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec"
|
||||
},
|
||||
"version": "0.2.2"
|
||||
}
|
||||
115
Client/node_modules/stat-mode/test/test.js
generated
vendored
Executable file
115
Client/node_modules/stat-mode/test/test.js
generated
vendored
Executable file
@@ -0,0 +1,115 @@
|
||||
|
||||
var Mode = require('../');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('stat-mode', function () {
|
||||
|
||||
it('should export the `Mode` constructor', function () {
|
||||
assert.equal('function', typeof Mode);
|
||||
assert.equal('Mode', Mode.name);
|
||||
});
|
||||
|
||||
describe('Mode', function () {
|
||||
|
||||
it('should return a `Mode` instance with `new`', function () {
|
||||
var m = new Mode({});
|
||||
assert(m instanceof Mode);
|
||||
});
|
||||
|
||||
it('should return a `Mode` instance without `new`', function () {
|
||||
var m = Mode({});
|
||||
assert(m instanceof Mode);
|
||||
});
|
||||
|
||||
it('should throw an Error if no `stat` object is passed in', function () {
|
||||
try {
|
||||
new Mode();
|
||||
assert(false, 'unreachable');
|
||||
} catch (e) {
|
||||
assert.equal('must pass in a "stat" object', e.message);
|
||||
}
|
||||
});
|
||||
|
||||
[
|
||||
{
|
||||
mode: 33188 /* 0100644 */,
|
||||
octal: '0644',
|
||||
string: '-rw-r--r--',
|
||||
type: 'file'
|
||||
},
|
||||
{
|
||||
mode: 16877 /* 040755 */,
|
||||
octal: '0755',
|
||||
string: 'drwxr-xr-x',
|
||||
type: 'directory'
|
||||
},
|
||||
{
|
||||
mode: 16832 /* 040700 */,
|
||||
octal: '0700',
|
||||
string: 'drwx------',
|
||||
type: 'directory'
|
||||
},
|
||||
{
|
||||
mode: 41325 /* 0120555 */,
|
||||
octal: '0555',
|
||||
string: 'lr-xr-xr-x',
|
||||
type: 'symbolicLink'
|
||||
},
|
||||
{
|
||||
mode: 8592 /* 020620 */,
|
||||
octal: '0620',
|
||||
string: 'crw--w----',
|
||||
type: 'characterDevice'
|
||||
},
|
||||
{
|
||||
mode: 24960 /* 060600 */,
|
||||
octal: '0600',
|
||||
string: 'brw-------',
|
||||
type: 'blockDevice'
|
||||
},
|
||||
{
|
||||
mode: 4516 /* 010644 */,
|
||||
octal: '0644',
|
||||
string: 'prw-r--r--',
|
||||
type: 'FIFO'
|
||||
}
|
||||
].forEach(function (test) {
|
||||
var m = new Mode(test);
|
||||
var isFn = 'is' + test.type[0].toUpperCase() + test.type.substring(1);
|
||||
var strMode = m.toString();
|
||||
var opposite = test.type == 'file' ? 'isDirectory' : 'isFile';
|
||||
var first = test.type == 'file' ? 'd' : '-';
|
||||
describe('input: 0' + test.mode.toString(8), function () {
|
||||
describe('#toString()', function () {
|
||||
it('should equal "' + test.string + '"', function () {
|
||||
assert.equal(m.toString(), test.string);
|
||||
});
|
||||
});
|
||||
describe('#toOctal()', function () {
|
||||
it('should equal "' + test.octal + '"', function () {
|
||||
assert.equal(m.toOctal(), test.octal);
|
||||
});
|
||||
});
|
||||
describe('#' + isFn + '()', function () {
|
||||
it('should return `true` for #' + isFn + '()', function () {
|
||||
assert.ok(m[isFn]());
|
||||
});
|
||||
it('should remain "' + strMode + '" after #' + isFn + '(true) (gh-2)', function () {
|
||||
assert.equal(true, m[isFn](true));
|
||||
assert.equal(strMode, m.toString());
|
||||
});
|
||||
});
|
||||
describe('#' + opposite + '(true)', function () {
|
||||
it('should return `false` for `#' + opposite + '(true)`', function () {
|
||||
assert.equal(false, m[opposite](true));
|
||||
});
|
||||
it('should be "' + first + m.toString().substring(1) + '" after #' + opposite + '(true) (gh-2)', function () {
|
||||
assert.equal(first + m.toString().substring(1), m.toString());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user