Re: [nodejs] Re: EMFILE error in Async file reading

2013-04-30 Thread Isaac Schlueter
As Ben said, as long as you're using positional reads (which fs.ReadStream does) then having multiple readers with the same fd is totally fine. However, if you're doing fs.read() without an explicit position, then the OS will just read from the "current offset" (ie, usually the last offset + last

Re: [nodejs] Re: EMFILE error in Async file reading

2013-04-30 Thread Fedor Indutny
Because you're reading file from start to end, and position changes at every read? Cheers, Fedor. On Tue, Apr 30, 2013 at 2:15 PM, Afshin Mehrabani wrote: > Sorry I didn't get it. Why should read an undefined position? or zero? > > On Tuesday, April 30, 2013 1:12:18 PM UTC+4:30, Ben Noordhuis w

Re: [nodejs] Re: EMFILE error in Async file reading

2013-04-30 Thread Afshin Mehrabani
Sorry I didn't get it. Why should read an undefined position? or zero? On Tuesday, April 30, 2013 1:12:18 PM UTC+4:30, Ben Noordhuis wrote: > > On Tue, Apr 30, 2013 at 8:08 AM, Afshin Mehrabani > > > wrote: > > Just another question guys, what about opening a link to the file and > then > > u

Re: [nodejs] Re: EMFILE error in Async file reading

2013-04-30 Thread Ben Noordhuis
On Tue, Apr 30, 2013 at 8:08 AM, Afshin Mehrabani wrote: > Just another question guys, what about opening a link to the file and then > use that link in all reads? I mean use fs.open and hold the fd parameter in > a global scope to use it in all other situations. > > Will this solution fix the pro

[nodejs] Re: EMFILE error in Async file reading

2013-04-29 Thread Afshin Mehrabani
Just another question guys, what about opening a link to the file and then use that link in all reads? I mean use fs.open and hold the fd parameter in a global scope to use it in all other situations. Will this solution fix the problem? On Monday, April 29, 2013 6:43:40 PM UTC+4:30, Afshin Meh

[nodejs] Re: EMFILE error in Async file reading

2013-04-29 Thread Afshin Mehrabani
Thank you guys, I got it. Also fs-graceful seems a good solution. On Monday, April 29, 2013 6:43:40 PM UTC+4:30, Afshin Mehrabani wrote: > > Today when I tried to implement an example of using async/sync I/O methods > in NodeJs, I faced an strange problem. When I'm trying to send requests > with