-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support listing files in a directory Path #222
Comments
I see a few design options here:
|
My current use case in tests is fairly simple. I'm using the API to either check the number of files in a directory using the size of the file list, or to recursively delete all the contents of a directory. The file/path list API works well for both of these requirements. An iterable sequence could also work, although it requires iterating and terminating the sequence to get the size. I would think if the underlying platform file API being used is already returning a list or array, there's probably not much value in mapping that existing collection to a sequence. The other API options could also be useful. It might make sense to offer these filter/iterable APIs in addition to a simple file/path list API. A recursive iteration API would be especially useful for the recursive delete operation. |
I think just returning a list of strings with the file names in the directory like |
I'd say lets not force rushed solutions. Once something is in it's difficult to take out and will just clutter the API. |
TL;DR: there were (and are) no signs that a proper stable FS API will be released soon (I mean in the next couple of months), so I decided to provide some API (FileSystem.list(Path): Collection) to make the library more usable. |
I agree with this decision! And it's unlikely that this API will change. Maybe the implementation, but |
Listing files within a directory is one of the few file APIs my library tests require that
kotlinx-io
doesn't currently support.Similar API references:
The text was updated successfully, but these errors were encountered: