The file download was returning 301 error because followRedirects was false. This bug was fixed by making this value true
During the reading of the file in the cache, an error was returned because it was not checked whether the file exists or not. Fixed bug by adding control to file read operation