New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

read-lines-riched

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-lines-riched - npm Package Compare versions

Comparing version 0.1.0 to 0.1.2

2

package.json
{
"name": "read-lines-riched",
"version": "0.1.0",
"version": "0.1.2",
"description": "Easy way to read lines of files. You can read lines from start to end of file or from end to start of file.",

@@ -5,0 +5,0 @@ "main": "main.js",

# Read Lines Riched
Easy way to read files line by line on two directions: from the beginning to the last and from the last to beginning.
Easy way to read file lines on two directions: from the beginning to the end and from the end to the beginning.

@@ -17,19 +17,43 @@ ## Installing

## Usage
## Usage with Promise
To use the module.
Reading lines example from the end of the file to the beginning.
```
const {readLinesStartToEnd, readLinesEndToStart} = require('read-lines-riched');
const {readLinesEndToStart} = require("read-lines-riched");
let endToStartRL = readLinesEndToStart("./testing_file");
var func = function () {
endToStartRL.readNextLine().then(line => {
if (line) {
console.log(line);
func()
}
else
endToStartRL.closeReader();
});
};
func();
```
## Usage with Async Await
To read lines from the begining of the file to the end.
Reading lines example from the beginning of the file to the end.
```
const startToEndRL = readLinesStartToEnd(file_path);
const line = await startToEndRL.readNextLine();
const { readLinesStartToEnd} = require("read-lines-riched");
const startToEndRL = readLinesStartToEnd("./testing_file");
(async function(){
var line = await startToEndRL.readNextLine();
while(line)
{
console.log(line);
line = await startToEndRL.readNextLine();
}
startToEndRL.closeReader();
})();
```
To read lines from the end of the file to the beginning.
```
let endToStartRL = readLinesEndToStart(file_path);
const line = await endToStartRL.readNextLine();
```

@@ -36,0 +60,0 @@ ## Contributing

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc