1.0.1 • Published 9 years ago

parents v1.0.1

Weekly downloads
891,762
License
MIT
Repository
github
Last release
9 years ago

parents

Return all the parent directories of a directory, inclusive of that directory.

build status

example

dirname

var parents = require('parents');
var dirs = parents(__dirname);
console.dir(dirs);

[ '/home/substack/projects/node-parents/example',
  '/home/substack/projects/node-parents',
  '/home/substack/projects',
  '/home/substack',
  '/home',
  '/' ]

win32

var parents = require('parents');
var dir = 'C:\\Program Files\\Maxis\\Sim City 2000\\cities';

var dirs = parents(dir, { platform : 'win32' });
console.dir(dirs);

[ 'C:\\Program Files\\Maxis\\Sim City 2000\\cities',
  'C:\\Program Files\\Maxis\\Sim City 2000',
  'C:\\Program Files\\Maxis',
  'C:\\Program Files',
  'C:' ]

methods

var parents = require('parents')

parents(dir, opts)

Return an array of the parent directories of dir, including and starting with dir. If a dir isn't specified, process.cwd() will be used.

Optionally specify an opts.platform to control whether the separator and paths works the unixy way with '/' or the windowsy way where sometimes things use '/' and sometimes they use '\\' and also there are leading drive letters and other exotic features. If opts.platform isn't specified, process.platform will be used. Anything that matches /^win/ will use the windowsy behavior.

install

With npm do:

npm install parents

licence

MIT

browserifybit-binwenke-browserifyencrypto-browserify@infinitebrahmanuniverse/nolb-pare@everything-registry/sub-chunk-2409projectssftp-clientreact-native-firebase-messagingpotterraynost-browserifyraynos-browserifyreactjs-github-widgetsources@xhonker/deploytanngoebit-binfxosappfis3-deploy-upload-sftpfis3-deploy-sftp-clientflexiconfigfenglin-uploaderfind-packagemodule-depsmodule-deps-disklessmodule-deps-sortable-2nguyegulp-clientlibifygulp-clientlibify-mirumgulp-clientlibs-mirummy-build-servegulp-ftpgulp-ssh-uploadgulp-sftpgulp-sftp-cleangulp-sftp-fixgulp-sftp-hdhgulp-sftp-keyboardgulp-sftp-newgulp-sftp-socksv5gulp-sftp-up4gulp-sftp-up5gulp-sftp-up5-hjfgulp-sftp-with-callbacksgulp-vsftpgulp-vsftpproitapekomkountexamplegulp-docker-destgupackgulp-fez-sftpnfs-config-resolverpackagerootpeerdeppc-build-servernode-serverifynode-sftp-deploynode-sftp-deploy-inode-sftp-deploy2owt-client-javascript@victorlizarraga/bit-javascript@zdychacek/browserify-babylon@zdychacek/module-depscovert@foxtail/gulp-sftp-up4confercordova-plugin-amplify-paycordova-plugin-amplify-paymentbowserifybuntbit-javascriptbrowserify-debufbrowserify-blentedbrowserify-fbrowserify-windows-fixcascadify@cobalt-engine/co-browserify@jimbly/browserify@juancarlosrmr/node-sftp-deploy-spbrowserify-lite2browser-unixconfuseuploadrapp-build-serverbalm-corebcx-browserifyvideo-multi-uploader@cljs-oss/module-depsdistify@jzetlen/bowserify@pirxpilot/browserify@pirxpilot/module-deps@mlie/quick-cli@mapbox/check-file-dependencies@nodeframe/config-resolver@novembrecom/zxcvbn@leichtgewicht/browserify@makeomatic/browserify@rstacruz/pnpm
1.0.1

9 years ago

1.0.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

12 years ago

0.0.0

12 years ago