Fetching a remote file


I’ve been looking for a way to read a remote file in a project. So if the currently open TextDocument is not remote I want to access the contents of its remote counterpart (if it exists) and if it’s remote I want to be able to fetch the current contents directly from the server (basically reload/redownload it). Is this currently possible? I haven’t seen a fitting API method so far