SnappyStream.Flush does not flush the underlying stream when writing

Issue #4 wontfix
Robert Važan repo owner created an issue

Originally submitted by (former user).

Calling SnappyStream.Flush does not flush the underlying stream when using compress mode.

For example, when using SnappyStream with a FileStream, flushing the snappy stream should write the bytes to disk and flush them but it does not. This can lead to lost data if the program crashes before closing the snappy stream (as would be the case when writing an infinite stream, like a log file).

If you do not want to make flushing the downstream stream the default, there should at least be a constructor option for doing so.

Comments (2)

  1. Robert Važan reporter

    I can confirm this is indeed a bug in SnappyStream.Flush. The current workaround is to call Close (or wrap your code in using statement). SnappyStream.Close calls Close on the underlying stream, which will flush it. There is no workaround for infinite streams.

  2. Log in to comment