Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including line-navigator with all npm packages installed. Try it out:

var LineNavigator = require("line-navigator"); // This is just some Tonic file available for us to read var navigator = new LineNavigator(__dirname + '/index.js'); // === Reading all lines === console.log("Reading all file by chunks:"); var indexToStartWith = 0; navigator.readSomeLines(indexToStartWith, function linesReadHandler(err, index, lines, isEof, progress) { console.log(` Chunk from line ${index} with ${lines.length} lines (${progress}%)`); // Error happened if (err) throw err; // Reading lines for (var i = 0; i < lines.length; i++) { var lineIndex = index + i; var line = lines[i]; // Do something with line } // progress is a position of the last read line as % from whole file length // End of file if (isEof) return; // Reading next chunk, adding number of lines read to first line in current chunk navigator.readSomeLines(index + lines.length, linesReadHandler); });

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

line-navigator v2.1.6

Reads, searches and navigates HTML5/Node.JS text files of any size in the browser or backend

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free