How to read files from Azure Data Lake and display those files in Angular-2?

1k Views Asked by At

I need to read files from Azure Data Lake and I have to display those files in Angular-2 Component. but i am getting only file properties from Azure Data Lake while using List File Status() method. but i need the file with content. how to read all the files with contents from azure Data Lake. I am listing all the file status using like below code.

                listOfFiles =  ListItems(pathOfFolder);
                var stTime = new DateTime();

                foreach (var file1 in listOfFiles) {

                    var srcPath = pathOfFolder + "/" + file1.PathSuffix;
                    using (var stream = adlsFileSystemClient.FileSystem.Open(_adlsAccountName, srcPath)) {
                        using (var fileStream = new FileStream(destPath, FileMode.Create))
                        {
                            stream.CopyTo(fileStream);
                            listOfStreams.Add(fileStream);

                        }
                    }

                }

But it will give list of file streams and it will take much time. is there any way to get all the files with content.?

1

There are 1 best solutions below

2
On

There is no API that will get all the files and their content in one shot. As one can imagine, a folder could have millions of files each potentially of terabytes of data. A single REST call cannot robustly return the enumeration as well as contents of such a large data set.

The way you are doing it is the correct way.