Implemented functionality to write downloaded files to a local directory