Debian Codegraph @

readme.markdown

raw symbols SCIP
1 # parents
2
3 Return all the parent directories of a directory, inclusive of that directory.
4
5 [![build status](https://secure.travis-ci.org/substack/node-parents.png)](http://travis-ci.org/substack/node-parents)
6
7 # example
8
9 ## dirname
10
11 ``` js
12 var parents = require('parents');
13 var dirs = parents(__dirname);
14 console.dir(dirs);
15 ```
16
17 ***
18
19 ```
20 [ '/home/substack/projects/node-parents/example',
21 '/home/substack/projects/node-parents',
22 '/home/substack/projects',
23 '/home/substack',
24 '/home',
25 '/' ]
26 ```
27
28 ## win32
29
30 ``` js
31 var parents = require('parents');
32 var dir = 'C:\\Program Files\\Maxis\\Sim City 2000\\cities';
33
34 var dirs = parents(dir, { platform : 'win32' });
35 console.dir(dirs);
36 ```
37
38 ***
39
40 ```
41 [ 'C:\\Program Files\\Maxis\\Sim City 2000\\cities',
42 'C:\\Program Files\\Maxis\\Sim City 2000',
43 'C:\\Program Files\\Maxis',
44 'C:\\Program Files',
45 'C:' ]
46 ```
47
48 # methods
49
50 ``` js
51 var parents = require('parents')
52 ```
53
54 ## parents(dir, opts)
55
56 Return an array of the parent directories of `dir`, including and starting with
57 `dir`. If a `dir` isn't specified, `process.cwd()` will be used.
58
59 Optionally specify an `opts.platform` to control whether the separator and paths
60 works the unixy way with `'/'` or the windowsy way where sometimes things use
61 `'/'` and sometimes they use `'\\'` and also there are leading drive letters and
62 other exotic features. If `opts.platform` isn't specified, `process.platform`
63 will be used. Anything that matches `/^win/` will use the windowsy behavior.
64
65 # install
66
67 With [npm](http://npmjs.org) do:
68
69 ```
70 npm install parents
71 ```
72
73 # licence
74
75 MIT