added option to allow for streaming large files without loading them into memory