node-keyword-scrapper
NodeJS library for searching keyword in directory and sub-directory. Library generates CSV report with number of occurrences for keyword and file count.
Getting started
How to use node keyword scrapper in your projects
License
This project is licensed under the MIT License. See LICENSE for more information.
Table of contents
Installation as dependency
$ npm install --save node-keyword-scrapper
Installation for CLI usage
$ npm install -g node-keyword-scrapper
Use as dependency
const lib = require('node-keyword-scrapper');
lib.searchKeysInDirectory(DIRECTORY_PATH, JSON_FILE_PATH, EXTENSIONS, OPTIONS);
Use as CLI
$ node-keyword-scrapper DIRECTORY_PATH, JSON_FILE_PATH, EXTENSIONS, OPTIONS ⏎
Options
params | description | example | required ? | default |
---|---|---|---|---|
directoryPath | Directory path to search for files | '/User/bob/folders' | true | |
keysFilePath | Path for JSON file containing keys | '/User/bob/key.json' | true | |
extensions | File extensions to search for | '.js,.html' | false | [ '.ts', '.html' ] |
opts | Options for key transpose | '{"output":"FOLDER_PATH","transpose":{"char":".","charReplacement":"?."},"exclude":["/node_modules","coverage"]}' | false | {} |
Reports
- Report is generated to CSV format
index | labelKey | occurrenceCount | fileCount | status |
---|---|---|---|---|
0 | 'import' | 11 | 8 | 'KEY_USED' |
1 | 'console.log' | 5 | 3 | 'KEY_USED' |
2 | 'throw' | 1 | 1 | 'KEY_USED' |
3 | 'console.table' | 0 | 0 | 'KEY_NEVER_USED' |