modified-read-file
v1.0.0
Published
Modified version of previous package read-them-files
Downloads
73
Readme
# Modified Read File
**Version**: 1.0.0
**Description**: This package reads a `.txt` file and outputs various statistics about its content such as the number of characters, words, alphabets, digits, special characters, new lines, and whitespaces. It also provides byte count information using different methods.
## Installation
You can install this package by running the following command:
```bash
npm install modified-read-file
Usage
Prepare your .txt file: Make sure you have a
.txt
file in the root directory of your project, namedexample.txt
(or modify the file path in the script).Run the script: Use the following command to execute the script:
node index.js
Output
Once executed, the script will provide the following information:
- Number of characters
- Number of words
- Number of alphabets
- Number of digits
- Number of special characters
- Number of new line characters
- Number of whitespaces
- Byte count (using Buffer.byteLength and raw/encoded methods)
Example Output:
File Statistics:
-----------------
Characters: 256
Words: 45
Alphabets: 150
Digits: 12
Special characters: 6
New lines: 5
Whitespaces: 38
Byte Count Information:
-----------------
Buffer.byteLength: 256
Raw buffer length: 256
Encoded buffer length: 256
Features
- Reads and analyzes
.txt
files. - Provides multiple file statistics including characters, words, digits, new lines, etc.
- Displays byte count using three different methods.
- Useful for text analysis, logging, or basic file exploration tasks.
Example
Here's an example of how you can use this package in your code:
const fileStats = require('modified-read-file');
fileStats.readFile('./example.txt');
License
This project is licensed under the ISC License.