file-index-builder

1.0.4 • Public • Published

File index builder

Build inverted index for local file. May help you build search system for static site.

CLI

example

npm install -g file-index-builder
build-index-cli build --path ./*.txt --excludePath ./abc.txt 

output file("fileIndex.json") may look like this("12ab" in aaa.txt)

{
    "1": [
        {
            "path": "aaa",
            "near": [
                "12ab"
            ]
        }
    ],
    "2": [
        {
            "path": "aaa",
            "near": [
                "2ab"
            ]
        }
    ],
    "a": [
        {
            "path": "aaa",
            "near": [
                "ab"
            ]
        }
    ],
    "b": [
        {
            "path": "aaa",
            "near": [
                "b"
            ]
        }
    ]
}

usage

Usage: build-index-cli build [options] [string]

build index

Arguments:
  string                    out file name, delfult "fileIndex.json" (default: "fileIndex.json")

Options:
  -r, --root                root dir
  -o, --outDir              output dir
  -c, --confirm             need confirm before build
  -e, --excludePath <glob>  path excluded (default: [])
  -p, --path <glob>         path of file you want to build index. (default: [])
  -pr, --printFile          print file built index
  -h, --help                display help for command

Source

https://github.com/aaadddfgh/file-index-builder/

License

BSD-3-Clause

Package Sidebar

Install

npm i file-index-builder

Weekly Downloads

8

Version

1.0.4

License

BSD-3-Clause

Unpacked Size

11.7 kB

Total Files

6

Last publish

Collaborators

  • aaadddfgh