node-keyword-scrapper
Version:
NodeJS keyword scrapper in folders and directory. Search and generate report for specific word in directory.
75 lines (53 loc) • 2.74 kB
Markdown
[](https://img.shields.io/npm/v/node-keyword-scrapper.svg?style=for-the-badge&logo=npm)
NodeJS library for searching keyword in directory and sub-directory. Library generates CSV report with number of occurrences for keyword and file count.
<p>
<img alt="github actions" src="https://img.shields.io/badge/-Github_Actions-2088FF?style=flat-square&logo=github-actions&logoColor=white" height=25 />
<img alt="javascript" src="https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black" height=25 />
<img alt="nodejs" src="https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white" height=25 />
</p>
---
How to use node keyword scrapper in your projects
This project is licensed under the MIT License. See LICENSE for more information.
- [Installation as dependency](
- [Installation for CLI usage](
- [Use as dependency](
- [Use as CLI](
- [Options](
- [Reports](
---
```
$ npm install --save node-keyword-scrapper
```
```
$ npm install -g node-keyword-scrapper
```
```
const lib = require('node-keyword-scrapper');
lib.searchKeysInDirectory(DIRECTORY_PATH, JSON_FILE_PATH, EXTENSIONS, OPTIONS);
```
```
$ node-keyword-scrapper DIRECTORY_PATH, JSON_FILE_PATH, EXTENSIONS, 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 | {} |
- 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' |