Fix the issue that input stream has been consumed which can not save to cache file