Make IFileSystem actions GetFileInfo, GetDirectoryContents async
@Praburaj I don't think that GetFileInfo will take much time, but i'm with you that GetDirectoryContents should be async
:+1:
I am trying to implement Azure Blob storage on top for this and it would be great to have async methods. I also think that IFileInfo.Exists should be a Task<bool> returning method, not a property.
@tugberkugurlu i don't think that the Exists property should be async
@hishamco depends on the purpose of this abstraction library. In my case, I need to make an HTTP call to figure out if the resource exists, which is a perfect fit for async.
@davidfowl do we want this?
I don't think so. This isn't a generic file system abstraction. A blog storage implementation would be pretty weird.
@davidfowl I'm agree with you what you said before, nothing but if we have a file system directory that contains nested directories and files, the GetDirectoryContentsAsync will be very helpful in such situation
I guess I'm not sure why the FileSystem repository wouldn't be a generic (read-only) file system abstraction.
I'd also appreciate async on the file system methods. Instances off the top of my head where this might be relevant:
- Network storage (whether NAS, SAN, Azure Blob Storage, or Amazon Cloud, or something more exotic)
- Globbed files (compressed storage such that the directory tree is in a file)
In these instances, getting lists of files, existence of files, and getting file info could all benefit from being retrieved async. In cases where the async specification is not beneficial, a Task.FromResult would alleviate most implementation difficulties.
:+1: for the asynt methods :)
+1 would be nice to have this too, was just looking to see if I could do something for async file storage in Orchard 2
Minus 1 for Exists becoming a task :p - given that a fileinfo first has to be retrieved (via GetFileInfo or GetDirectoryContents) it seems you should know at that point - ahead of instantiating the FileInfo whether the requested file / directory exists or not.. imho.
I have also thought about an azure blob storage provider.. but I stopped when I thought about its Change Token implementation. It remains a crazy dream.
I agree, Exists should stay non async
+1 for providing an async interface to IFileProvider. Since the configuration system is built on top of this we often have to make network calls to see if configs need to be refreshed. I love that this interface provides a Watch method for refreshing on changes but without the ability to make an async call to retrieve the file info it severely limits its usefulness.
This issue was moved to aspnet/Home#2567