Refactor io stream insead of bytes copy when offline file transfer