Thanks. It almost works. The problem is I don't know the size of the file until it has finished streaming. It looks like the tar file format need the file size written at the beginning :(