```js
var writable = stream.pipe(fs.createWriteStream(localPath))

writable.on("finish", function () {
  // file should be written now
})
```

The WritableStream should emit "finish" after it has flushed the large
chunk of data to the source it's writing to.

The ReadableStream emits "end" after it has moved it's last chunk to the
Writable WITHOUT waiting for the Writable to flush.

So waiting on `"end"` has no garantuees about the Writable


On Mon, Jul 1, 2013 at 3:58 PM, Mark Hahn <[email protected]> wrote:

> And one more question.  What is a way in general to guarantee a file has
> finished writing?  I assume if I run fs.stat it will return with successful
> data even if it isn't finished writing.  If I know what the file length is
> then I could make sure the length is correct, but what if I don't know the
> length?
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to