Substitute File.Readlines() with something that is able to read URL/https
NickName:Fissure Ask DateTime:2020-06-13T13:21:34

Substitute File.Readlines() with something that is able to read URL/https

I'm trying to parse a .csv file located in Azure blob storage. When I parse the .csv file from my local using File.Readlines(), it works fine. When I pass the path of the blob and debug, I get the following message at File.Readlines():

enter image description here

Here's my code:

public IList<blabla> getFiles()
        {
            _rootFileDirectory = configurationService.GetString("stuff-stuff-stuff-stuff");

            var path = Path.Combine(_rootFileDirectory + "File", $"{_Id}.csv");
            var filePath = path.Contains("https://") ? path.Replace('\\', '/') : path;
            var listOfObjects = Parser(filePath); <-----
            return listOfObjects;
        }

        private IList<blabla> Parser(string filePath)
        {
            var Data = File.ReadLines(filePath); <-----
            foreach...
        }

The path that keeps failing is:

<add key="stuff-stuff-stuff-stuff" value="https://*******.blob.core.windows.net/******/" />

Again, when I run from my local (C:\Users\*******\Desktop\), it works fine. I'm guessing this is because File.Readlines() isn't able to read https paths. Can anyone confirm this and help me find a work-around with the same functionality?

Thanks in advance for helping a noob out.

Copyright Notice:Content Author:「Fissure」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/62355867/substitute-file-readlines-with-something-that-is-able-to-read-url-https

More about “Substitute File.Readlines() with something that is able to read URL/https” related questions

Substitute File.Readlines() with something that is able to read URL/https

I'm trying to parse a .csv file located in Azure blob storage. When I parse the .csv file from my local using File.Readlines(), it works fine. When I pass the path of the blob and debug, I get the

Show Detail

Is File.ReadLines buffering read lines?

I have a very long text file (about 600MB of text) which I want to parse line by line. I can simply use StreamReader.ReadLine() method, but I'd like to know if using LINQ with File.ReadLines(filepa...

Show Detail

File.readlines invalid byte sequence in UTF-8 (ArgumentError)

I am processing a file which contains data from the web and encounter invalid byte sequence in UTF-8 (ArgumentError) error on certain log files. a = File.readlines('log.csv').grep(/watch\?v=/).map...

Show Detail

mod_substitute JSON Replace URL

referring to THIS Question: UseCase: I POST a Request which I alter by ProxyPass / ProxyPassReverse zu reach the Backend Server. The Response consits of Content-Type application/json, which contia...

Show Detail

Is there a maximum for the read in line of File.ReadLines()?

What happen if the file has very-long line(s)? Is there any limitation to how long a line is to iterate each of File.ReadLines()

Show Detail

File.ReadLines "Can't Read From Closed TextReader"

I have been getting a wierd excepction that i am not sure what is causing it. In my local machine when i use: var lines = File.ReadLines("filePath"); foreach(string line in lines)... This works

Show Detail

Why File.ReadLines() in C# allocates too much memory?

I have twenty 10MB txt files and would like to read these files. I have read this, which says File.ReadLines() doesn't load entire lines so it doesn't spend much memory. var directory = &quot;path/to/

Show Detail

Using read.fwf() with HTTPS

I'm trying to read the fixed-width file directly from the server, without downloading and writing a file and parsing it. If I do something like &gt; read.fwf(url("http://..."),columns) then I ge...

Show Detail

File.ReadLines without locking it?

I can open a FileStream with new FileStream(logfileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); Without locking the file. I can do the same with File.ReadLines(string path)?

Show Detail

mockery not able to register substitute

I have a problem registering substitutes with mockery. My usecase is that I want to substitute react-native-router-flux with my own. So I created a file rn-router-mock.js which resides in a path

Show Detail