Fully configurable buffered reader for node.js.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 30 commits behind gagle:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
build minor bugs Aug 17, 2012
examples updated example Jul 25, 2012
test updated modules Aug 17, 2012
.gitignore v0.0.2 Apr 11, 2012
LICENSE v0.0.2 Apr 11, 2012
README.md updated readme Sep 8, 2012


Node BufferedReader

Fully configurable buffered reader for node.js

Show me! | Availability | Compatibility | Documentation

Version: 0.2.7

When you need to read a file you typically read a chunk of bytes called "buffer" to avoid multiple calls to the underlying I/O layer, so instead of reading directly from the disk, you read from the previous filled buffer. Doing this you win performance.

This library allows you to read files using internal buffers, so you don't have to worry about them. In addition, you can read a text file line by line.

Show me!

var BufferedReader = require ("buffered-reader");

var offset;

new BufferedReader ("file", { encoding: "utf8" })
	.on ("error", function (error){
		console.log (error);
	.on ("line", function (line, byteOffset){
		if (line === "Phasellus ultrices ligula sed odio ultricies egestas."){
			offset = byteOffset;
			this.interrupt ();
	.on ("end", function (){
		this.seek (offset, function (error){
			if (error) return console.log (error);
			this.readBytes (9, function (error, bytes, bytesRead){
				if (error) return console.log (error);
				console.log (bytes.toString ()); //Prints: Curabitur
				this.close (function (error){
					if (error) console.log (error);
	.read ();


Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Morbi convallis nibh massa, eu varius felis.

Phasellus ultrices ligula sed odio ultricies egestas.
Curabitur pretium magna in diam accumsan dignissim.
Phasellus et tortor eu orci suscipit vehicula.
Phasellus pulvinar mauris in purus consequat vel congue orci hendrerit.
Pellentesque eget arcu magna, suscipit imperdiet eros.


Via npm:

npm install buffered-reader


✔ Node *


Change Log
MIT License