Hey All,
I have been trying to research how to get a file (basically a csv file) from a url to an array and my search has come up with some examples, but not quite what I am looking for. Would appreciated any direction and or other examples of folks that have done this before.
Basically we have a cloud computer set up (Hadoop) and the output of some of our processes is what I am trying to get to..
the file is something like
http://ourserver...com:port#/filetos...es/actual_file
so if you put that in a browser, a 'save file dialog comes up' so i know the link if valid.
In .net was looking into using SYSTEM.NET and a simple downloadfile sub
but that just downloads it to a local file... which is what I want to do, but first have to to load each row into an array and manipulate the data just a bit....
also read this bit of code somewhere but it has to do with images and again it only downloads doesn't really interact with the stream
would definitely love some help!!!
Thanks ahead of time,
Eric
I have been trying to research how to get a file (basically a csv file) from a url to an array and my search has come up with some examples, but not quite what I am looking for. Would appreciated any direction and or other examples of folks that have done this before.
Basically we have a cloud computer set up (Hadoop) and the output of some of our processes is what I am trying to get to..
the file is something like
http://ourserver...com:port#/filetos...es/actual_file
so if you put that in a browser, a 'save file dialog comes up' so i know the link if valid.
In .net was looking into using SYSTEM.NET and a simple downloadfile sub
Code:
Public Sub DownLoadFile(ByVal address As String, _
ByVal fileName As String)
End Sub
also read this bit of code somewhere but it has to do with images and again it only downloads doesn't really interact with the stream
Code:
Dim wr As HttpWebRequest = CType(WebRequest.Create(sfile), HttpWebRequest)
Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
Dim str As Stream = ws.GetResponseStream()
Dim inbuf(1000000) As Byte
Dim bytesToRead As Integer = CInt(inbuf.Length)
Dim bytesRead As Integer = 0
While bytesToRead > 0
Dim n As Integer = str.Read(inbuf, bytesRead, bytesToRead)
If n = 0 Then
Exit While
End If
bytesRead += n
bytesToRead -= n
End While
Thanks ahead of time,
Eric
Comment