baudehlo / node-fs-ext

Extras missing from node's fs module
MIT License
101 stars 45 forks source link

Update seek() to return current file position ala lseek() #2

Closed tshinnic closed 13 years ago

tshinnic commented 13 years ago

Somewhat icky change to how values are returned to callbacks in the After() routine in fs-ext.cc Problem is that we don't have anything easy to switch on to determine when to return something more than the 'err' value. So change just always returns 'result' as the second argument to callbacks. (Note we don't have to worry about result colliding with the error value of -1 as lseek() would not return a negative position) Another option would be to have an "After2" routine that would always return err&result, leaving After() alone to return just err. Icky...

I've updated the README.md to mention seek() now returning the current file position.

baudehlo commented 13 years ago

This always returns two args, even in the flock() case.

Wouldn't it be better to add a flag to store_data_t to say what call we're doing here (and an enum of call types) and deal with it appropriately?

tshinnic commented 13 years ago

It would be more precise, and would allow more flexibility for future work, sure. But I was trying for "minimum change". (habit)

I'll go do that later, as I start to do utime(), which is even more fun on the input arguments.

On Wed, Jun 15, 2011 at 10:56 AM, baudehlo < reply@reply.github.com>wrote:

This always returns two args, even in the flock() case.

Wouldn't it be better to add a flag to store_data_t to say what call we're doing here (and an enum of call types) and deal with it appropriately?

Reply to this email directly or view it on GitHub: https://github.com/baudehlo/node-fs-ext/pull/2#issuecomment-1374655