UNPKG

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
# node-keyword-scrapper [![NPM version](https://img.shields.io/npm/v/node-keyword-scrapper.svg?flat&logo=npm)](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> --- ## 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](#installation-as-dependency) - [Installation for CLI usage](#installation-for-cli-usage) - [Use as dependency](#use-as-dependency) - [Use as CLI](#use-as-cli) - [Options](#options) - [Reports](#reports) --- ### 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' |