Closed benishak closed 8 years ago
can someone help to fix the error ? why i'm getting Bad Argument from fs.readSync ...
I've added reset method in 0.2.4.
I also added close method
https://github.com/nacholibre/node-readlines/pull/5/commits/69e239f412a1439e87e776f24cd52c00ed7b0bf4 https://github.com/nacholibre/node-readlines/pull/5/commits/ca26fe2e4ca71524c4624b67e73a51efbc706555
useful when searching for something in the file to avoid too many open files
while(la = a.next())
b = new lineByline(path)
while(lb = b.next())
if (a.toString() == b.toString())
found <- a.toString
b.close()
break
print found
the file is closed when the end is reached, so this close() method is not necessary.
no it is useful, take the following example
if you have two files and you want to search for entries from the first file in the 2nd file.
you may find it at the middle of the file
if you dont close the file you will get too many open files" I close it now in this way
fs.closeSync(file.fd)
while(la = a.next())
b = new lineByline(path)
while(lb = b.next())
if (a.toString() == b.toString())
found <- a.toString
b.close()
break
print found
you should let ppl contribute, not just copy their contribution and commit them as yours!
I didn't copy anything, I've just implemented reset method, because you've requested and yours didn't pass the test.. I think I made you a favour.
I will not merge your pull request about the close method, because close method is not necessary.
4