Logic for streaming files from server to client.