Skip to content
Browse files

Fixes issue #32

  • Loading branch information...
1 parent 04d6db1 commit 676e210fc451a8da21074b7856729f9957af5d01 Ryan McGrath committed Nov 9, 2012
Showing with 8 additions and 1 deletion.
  1. +4 −0 lib/wrench.js
  2. +4 −1 readme.md
View
4 lib/wrench.js
@@ -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");
View
5 readme.md
@@ -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
@@ -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://twitter.com/ryanmcgrath)

0 comments on commit 676e210

Please sign in to comment.
Something went wrong with that request. Please try again.