|wrote on 13.02.19 at 12:06last edited by dmka on 13.02.19 at 12:37|
I am capturing streams from a Windows VM and write them to network share (NAS). The streamWriter is set to overwrite the smaller files with bigger ones. However, when streamWriter is unable to write the new file (network error?) it still deletes the old one and leaves a zero-length file (see the screenshot attached).
Do the file replacement more "transactional". Rename the old file to file+.tmp, write the new one, delete .tmp if write was successful, undo otherwise.
I would also appreciate having an option to write stream files to a separate directory, e.g. write to a local storage and move to a network share when the track is fully recorded.
P.S. BTW I don’t know why the noted above network error happens – the network connection to NAS is 1Gb and is very reliable and I don’t experience any problems like this with other apps. However, the tracks from this station are much bigger (100-200MB per file) than usual.