How to get name of file from writeStream?

javascript, node.js, stream

Solution

It's `fs.createWriteStream` and `stream.path`

You can `console.dir(stream)` to find all it's properties

Problem

Here is what I want to do: ``` stream = fs.WriteStream('crap.txt',{flags:'w'}; // more code response.on('close',function() { // is the below line possible? fs.stat(stream.name, function(stats) { console.log(stats.size); }); stream.end(); }); ``` So can I get the filename from the stream object? An illustrated example would be nice, with reference to good tutorial/docs (containing examples) on writable streams.

Original source