UNPKG

2.4 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Stats } from 'fs';
3declare function createMode(stat?: number | createMode.StatsMode): createMode.Mode;
4declare namespace createMode {
5 type StatsMode = Pick<Stats, 'mode'>;
6 function isStatsMode(v: any): v is StatsMode;
7 class RWX {
8 protected static r: number;
9 protected static w: number;
10 protected static x: number;
11 private stat;
12 constructor(stat: StatsMode);
13 get read(): boolean;
14 set read(v: boolean);
15 get write(): boolean;
16 set write(v: boolean);
17 get execute(): boolean;
18 set execute(v: boolean);
19 }
20 class Owner extends RWX {
21 protected static r: number;
22 protected static w: number;
23 protected static x: number;
24 }
25 class Group extends RWX {
26 protected static r: number;
27 protected static w: number;
28 protected static x: number;
29 }
30 class Others extends RWX {
31 protected static r: number;
32 protected static w: number;
33 protected static x: number;
34 }
35 class Mode {
36 owner: Owner;
37 group: Group;
38 others: Others;
39 private stat;
40 constructor(stat?: number | StatsMode);
41 private checkModeProperty;
42 isDirectory(v?: boolean): boolean;
43 isFile(v?: boolean): boolean;
44 isBlockDevice(v?: boolean): boolean;
45 isCharacterDevice(v?: boolean): boolean;
46 isSymbolicLink(v?: boolean): boolean;
47 isFIFO(v?: boolean): boolean;
48 isSocket(v?: boolean): boolean;
49 /**
50 * Returns an octal representation of the `mode`, eg. "0754".
51 *
52 * http://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation
53 *
54 * @return {String}
55 * @api public
56 */
57 toOctal(): string;
58 /**
59 * Returns a String representation of the `mode`.
60 * The output resembles something similar to what `ls -l` would output.
61 *
62 * http://en.wikipedia.org/wiki/Unix_file_types
63 *
64 * @return {String}
65 * @api public
66 */
67 toString(): string;
68 valueOf(): number;
69 get setuid(): boolean;
70 set setuid(v: boolean);
71 get setgid(): boolean;
72 set setgid(v: boolean);
73 get sticky(): boolean;
74 set sticky(v: boolean);
75 }
76}
77export = createMode;