A node module to get full path of a directory and your nested directories or the full path of each file at each nested directory.
npm install fullpath
#English version
A node module to get full path of a directory and your nested directories or the full path of each file at each nested directory.
- fullpath now has support to exclude folders and select only files with a extension that you specified. Please see examples 4 and 5 for more information about that how to use the new features.



_Coverage 99.02%_
``bash`
$ [sudo] npm install fullpath --save$3
The following example attaches fullpath to a simple node.js app
_Directory structure:_
`
├── example/
│ ├── empty /
│ ├── nested /
│ │ ├── nested-a/
│ │ │ ├── a1/
│ │ │ │ ├── empty.js
│ │ │ ├── a2/
│ │ │ │ ├── a21/
│ │ │ │ │ ├── a211/
│ │ │ │ │ │ ├── empty.js
│ │ │ │ │ │ ├── example.js
│ │ ├── nested-b/
│ │ │ ├── b1/
│ │ │ │ ├── b11/
│ │ │ │ │ ├── empty.js
│ │ │ │ │ ├── empty.json
│ │ │ │ ├── empty.js
├── index.js
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'type': 'both', //optional. If you specified this value, by default is set with 'files'
'allFiles': true //optional. If you specified this value, by default is set with false and the result was full path of files with .js and .json extension.
});
console.log(fullPaths);
``
Run the app:`
node index.js`
gives the following output
[ 'your_current_working_directory/example/empty',
'your_current_working_directory/example/nested',
'your_current_working_directory/example/nested/nested-a',
'your_current_working_directory/example/nested/nested-b',
'your_current_working_directory/example/nested/nested-a/a1',
'your_current_working_directory/example/nested/nested-a/a2',
'your_current_working_directory/example/nested/nested-b/b1',
'your_current_working_directory/example/nested/nested-a/a2/a21',
'your_current_working_directory/example/nested/nested-b/b1/b11',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'type': 'files', //optional. If you don't specified this value, by default is set with 'files'
'allFiles': true //optional. If you don't specified this value, by default is set with false and the result was full path of files with .js and .json extension.
});
console.log(fullPaths);
``
Run the app:`
node index.js`
gives the following output
[ 'your_current_working_directory/example/nested/nested-a/a1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.json',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.md', // .md
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/empty.js',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/example.js' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'type': 'files', //optional. If you don't specified this value, by default is set with 'files'
'allFiles': false //optional. If you don't specified this value, by default is set with false and the result was full path of files with .js and .json extension.
});
``
Run the app:`
node index.js`
gives the following output
[ 'your_current_working_directory/example/nested/nested-a/a1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.json',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/empty.js',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/example.js' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'ext': 'md'
});
``
Run the app:`
node index.js`
gives the following output
[ 'your_current_working_directory/example/nested/nested-a/a1/empty.md',
'your_current_working_directory/example/nested/nested-b/b1/empty.md',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.md',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/empty.md' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'ext': 'md', //it's not mandatory
'exc': ['nested-b', 'a1']
});
``
Run the app:`
node index.js`
gives the following output
[ '/home/davidenq/Code/fullpath/test/example/nested/nested-a/empty.md',
'/home/davidenq/Code/fullpath/test/example/nested/nested-a/a2/a21/a211/empty.md' ]
`
`bash`
$ npm testSupport
If you need help using fullpath, or have found a bug, please create an issue on the
GitHub repo.
MIT Licence
#Versión Español
#fullpath
Un módulo para node.js que obtiene la ruta de acceso completa de una carpeta y sus carpetas anidadas o la ruta completa de todos los archivos contenidos en cada carpeta anidada.
- el módulo fullpath ahora soporta dos nuevas caraceterísticas: excluir carpetas y seleccionar archivos con una extensión especificada. Por favor, ver los ejemplos 4 y 5 para mayor información acerca de como usar estas nuevas características.
###Instalación
`bash`
$ [sudo] npm install fullpath --save
###¿Cómo usar?
A continuación se muestra un ejemplo sencillo de la ejecución del módulo.
_Estructura de la carpeta (folder):_
`
├── example/
│ ├── empty /
│ ├── nested /
│ │ ├── nested-a/
│ │ │ ├── a1/
│ │ │ │ ├── empty.js
│ │ │ ├── a2/
│ │ │ │ ├── a21/
│ │ │ │ │ ├── a211/
│ │ │ │ │ │ ├── empty.js
│ │ │ │ │ │ ├── example.js
│ │ ├── nested-b/
│ │ │ ├── b1/
│ │ │ │ ├── b11/
│ │ │ │ │ ├── empty.js
│ │ │ │ │ ├── empty.json
│ │ │ │ ├── empty.js
├── index.js
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'type': 'files', //opcional. Si no especifica este valor, por defecto el valor será seteado con 'files'
'allFiles': false //optional. Si no especifica este valor, por defecto dicho valor será seteado con false y obtendrá el resultado las rutas complestas únicamente de
// archivos con extensión .json y .js
});
``
Ejecutar la app:`
node index.js`
El resultado es:
[ 'your_current_working_directory/example/empty',
'your_current_working_directory/example/nested',
'your_current_working_directory/example/nested/nested-a',
'your_current_working_directory/example/nested/nested-b',
'your_current_working_directory/example/nested/nested-a/a1',
'your_current_working_directory/example/nested/nested-a/a2',
'your_current_working_directory/example/nested/nested-b/b1',
'your_current_working_directory/example/nested/nested-a/a2/a21',
'your_current_working_directory/example/nested/nested-b/b1/b11',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'type': 'files', //opcional. Si no especifica este valor, por defecto el valor será seteado con 'files'
'allFiles': true //optional. Si no especifica este valor, por defecto dicho valor será seteado con false y obtendrá el resultado las rutas complestas únicamente de
// archivos con extensión .json y .js
});
``
Ejecutar la app:`
node index.js`
El resultado es:
[ 'your_current_working_directory/example/nested/nested-a/a1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.json',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.md', // .md
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/empty.js',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/example.js' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'type': 'files', //opcional. Si no especifica este valor, por defecto el valor será seteado con 'files'
'allFiles': false //optional. Si no especifica este valor, por defecto dicho valor será seteado con false y obtendrá el resultado las rutas complestas únicamente de
// archivos con extensión .json y .js
});
``
Ejecutar la app:`
node index.js`
El resultado es:
[ 'your_current_working_directory/example/nested/nested-a/a1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.js',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.json',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/empty.js',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/example.js' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'ext': 'md'
});
``
Ejecutar la app:`
node index.js`
gives the following output
[ 'your_current_working_directory/example/nested/nested-a/a1/empty.md',
'your_current_working_directory/example/nested/nested-b/b1/empty.md',
'your_current_working_directory/example/nested/nested-b/b1/b11/empty.md',
'your_current_working_directory/example/nested/nested-a/a2/a21/a211/empty.md' ]
`
index.js
`js
const fullPaths = new FullPath.Search({
'path': '/example',
'dirname': __dirname,
'ext': 'md', //it's not mandatory
'exc': ['nested-b', 'a1']
});
``
Ejecutar la app:`
node index.js`
gives the following output
[ '/home/davidenq/Code/fullpath/test/example/nested/nested-a/empty.md',
'/home/davidenq/Code/fullpath/test/example/nested/nested-a/a2/a21/a211/empty.md' ]
`
`bash``
$ npm test
Si necesitas ayuda usando el módulo fullpath, o si encuentras un bug, por favor crea un issue en GitHub repo.
MIT Licence