https://github.com/joscha/indexifier
Generate an index from a directory
https://github.com/joscha/indexifier
html index index-generator indexer indexing listing tree
Last synced: 8 months ago
JSON representation
Generate an index from a directory
- Host: GitHub
- URL: https://github.com/joscha/indexifier
- Owner: joscha
- License: mit
- Created: 2016-09-29T14:25:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-08T12:49:52.000Z (almost 2 years ago)
- Last Synced: 2025-05-06T21:07:11.736Z (about 1 year ago)
- Topics: html, index, index-generator, indexer, indexing, listing, tree
- Language: JavaScript
- Size: 1.88 MB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generate an index for a given directory
[](https://greenkeeper.io/)
[](https://travis-ci.org/joscha/indexifier)
[](https://www.npmjs.com/package/indexifier)


[](http://commitizen.github.io/cz-cli/)
[](https://github.com/semantic-release/semantic-release)
This module generates a tree view of a given directory.
## Usage
### CLI API
```
Usage: indexifier [options]
Options:
-h, --help output usage information
-V, --version output the version number
-e, --extensions The extensions to take into account (defaults to .htm,.html)
-I, --include Include files and directories that are matched by this regular expression (defaults to all)
-E, --exclude Exclude files and directories that are matched by this regular expression (defaults to none)
-H, --html Enable to generate HTML output
-L, --no-link-folders Do not link folders when in HTML output mode
-F, --no-empty-directories Do not include empty directories
-D, --max-depth Limit results to a maximum sub-directory depth
```
#### Install
```console
npm install -g indexifier
```
#### Examples
```console
indexifier ./ --extensions .html,.htm
```
would generate something like this:
```
A
├─┬ B
│ └── c.html
├── d.html
└── e.html
```
There is also an HTML flag that would generate the above output as linked HTML:
```console
indexifier --extensions .html --html .
```
```html
A
├─┬ B
│ └── c.html
├── a.html
└── b.html
```
> The links are always relative to the given directory.
### Node API
```
indexifier(String directory [, opts={
fileTypes: Array.,
include=undefined: Regexp,
exclude=undefined: Regexp,
isHtml=false: Boolean,
linkFolders=true: Boolean,
emptyFolders=true: Boolean,
maxDepth=Infinity: Number,
}]);
```
#### Install
```console
npm install indexifier --save
```
#### Examples
Tree of files:
```js
const indexifier = require('indexifier');
const treeOfFiles = indexifier(__dirname);
```
Tree of HTML files:
```js
const indexifier = require('indexifier');
const treeOfHtmlFiles = indexifier(__dirname, { fileTypes: ['.html'] });
```
or for HTML output:
```js
const indexifier = require('indexifier');
const treeOfJpegFiles = indexifier(__dirname, {
fileTypes: ['.jpg', '.jpeg'],
isHtml: true
});
```