This sounds like an XY problem. I would first recommend not streaming to disk, but streaming to a program that does compression, and write that to disk.
If that’s unavoidable, can you stream to a pipe or socket? A compressor should be able to read from there and do its work.
If you can’t control the stream to disk, there are plenty of file watcher tools that can run arbitrary commands.