Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
Fixes issue #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan McGrath committed Nov 9, 2012
1 parent 04d6db1 commit 676e210
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/wrench.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ exports.LineReader = function(filename, bufferSize) {
};

exports.LineReader.prototype = {
close: function() {
return fs.closeSync(this.fd);
},

getBufferAndSetCurrentPosition: function(position) {
var res = fs.readSync(this.fd, this.bufferSize, position, "ascii");

Expand Down
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ var f = new wrench.LineReader('x.txt');
while(f.hasNextLine()) {
util.puts(x.getNextLine());
}

// Note: You will need to close that above line reader at some point, otherwise
// you will run into a "too many open files" error. f.close() or fs.closeSync(f.fd) are
// your friends, as only you know when it is safe to close.
```

### Asynchronous operations
Expand All @@ -54,7 +58,6 @@ var files = [];
wrench.readdirRecursive('my_directory_name', function(error, curFiles) {
// curFiles is what you want
});

```

Questions, comments? Hit me up. (ryan [at] venodesigns.net | http:https://twitter.com/ryanmcgrath)

0 comments on commit 676e210

Please sign in to comment.