use advanced api to stream into file handle