Is it possible to read a file on the internet without downloading it - page 2

 
pipspider:

Can you give me a hint as to how to achieve this

Depends upon the flavor of the server.

If the server has ssh, you could use that.

If it's a Windows server, there is RDP.

You'd really have to talk to the administrator of the server to find out what it's capable of doing.

 
Anthony Garot:

Depends upon the flavor of the server.

If the server has ssh, you could use that.

If it's a Windows server, there is RDP.

You'd really have to talk to the administrator of the server to find out what it's capable of doing.

Thanks Anthony, I will look more into it...
thanks again for your time.. much appreciated.. :)

 
whroeder1:

Not without downloading it you can't.

I was referring to your "translation" of course, no need to go to library and borrow the book, you can simply use the digital library now(so yes there is a way to read the book in the library without going to library and borrowing it).. :D

Forum on trading, automated trading systems and testing trading strategies

Is it possible to read a file on the internet without downloading it

whroeder1, 2018.06.22 15:04

Translation: I want to read a book that's in the library.. currently I go to the library and borrow it, but Is there a way to read the book from the library without borrowing it?

No, you can't, obviously.


 

This seems like a, "how do I double the complexity of a simple problem" type question. In order to "read partial" csv you'd need an API running on the server that could generate results based on a specific request. Something like:

Request:

{
   "get_csv_data": {
      "name": "csvfile.csv",
      "row": 0
   }
}

Response:

{
   "response": {
      "name": "csvfile.csv",
      "row_data": [1,2,3,4,5]
   }
}


Perhaps a better analogy would be, "how do I read a web-page without downloading the HTML"? 

 

After pondering the nature of OPs odd request, I think OP may be really asking how he can use requests to directly use the csv text in the response as opposed to saving the file to disk and reading from the disk file. In that case yes, it's easy, as long as the server doesn't send the response as a zipped file. Here is an example:


void OnStart()
{
   char data[];
   char result[];
   string result_headers;
   string url = "https://data.cityofnewyork.us/api/views/kku6-nxdu/rows.csv?accessType=DOWNLOAD";
   int r = WebRequest("GET", url, "", 10, data, result, result_headers);
   if(r < 0)
      Print(ErrorDescription(_LastError));
   
   string csv = CharArrayToString(result);
   string rows[];
   StringSplit(csv, '\n', rows);
   if(ArraySize(rows) > 0)
      Print(rows[0]);

}

result:

JURISDICTION NAME,COUNT PARTICIPANTS,COUNT FEMALE,PERCENT FEMALE,COUNT MALE,PERCENT MALE ....
 
pipspider:
I want to read a csv file on internet.. currently I download it and read it from there, but is there a way to read the file from the internet without downloading it?

I remember that I had a similar question before.

In Csharp version of HttpWebRequest class (or it might be FtpWebRequest class), it will download it into your Memory only. After, it will just automatically delete them from the memory.

It is still downloading but it will not create any files in your hard drive. But this is much better solution than downloading the file in your hard drive, then deleting the file programmatically by your EA.

Because if you get any error or interruption before deleting the file, the file will not be removed by your EA. Therefore, it is insecure. But if you process your file contents only in the memory, then you will be more secure because they are guaranteed to be removed even if the program fails to delete them.

Creating DLL might be better solution due to more freedom.

 
Young Ho Seo:

I remember that I had a similar question before.

In Csharp version of HttpWebRequest class (or it might be FtpWebRequest class), it will download it into your Memory only. After, it will just automatically delete them from the memory.

It is still downloading but it will not create any files in your hard drive. But this is much better solution than downloading the file in your hard drive, then deleting the file programmatically by your EA.

Because if you get any error or interruption before deleting the file, the file will not be removed by your EA. Therefore, it is insecure. But if you process your file contents only in the memory, then you will be more secure because they are guaranteed to be removed even if the program fails to delete them.

Creating DLL might be better solution due to more freedom.

It's not necessary unless the file is zipped. Just parse the response text by splitting the rows by `\n` and the columns by `,`, 

 
nicholi shen:

After pondering the nature of OPs odd request, I think OP may be really asking how he can use requests to directly use the csv text in the response as opposed to saving the file to disk and reading from the disk file. In that case yes, it's easy, as long as the server doesn't send the response as a zipped file. Here is an example:


result:

Brilliant that's exactly what I wanted, Appreciate your time sir..
Thank you very much..
Reason: