When I've opened a file as a stream, e.g. with fs.createWriteStream, how do I reliably get the backing file descriptor of the stream?
(I need the file descriptor to call functions like fs.futimes on it.)
There appears to be stream.fd, but it's null for a fraction of a second before it gets set. So how do I get the file descriptor once it's available?
var stream = fs.createWriteStream('./something.txt');
stream.on('open', function (fd) {
// here is an fd
})
this is actually documented (http://nodejs.org/api/fs.html#fs_event_open_1), whereas both fd option and property are not