move file stream to Response class