How to know file position in Node.js? - return value of lseek

It seems there's no "native" way for this. Probably because of

It is unsafe to use fs.write***() multiple times on the same file without waiting for the callback.

It would be even more so with something like getCurrentPosition for a buffered IO. What it should return after write*** or read*** but before the callback is called?

But you can try and keep track of the current position yourself with the help of bytesRead and bytesWritten. And in case of streams there is chunk.length, but don't forget about encodings in case of strings.


As a side note... you've wrote:

thinking to new features I thought this could be an useful info

If no one requested it, and you yourself is not sure what it can be used for, then I think it's a good idea to exercise YAGNI principle.