Essentially this would allow a user to get file references without having to know file names or hacky workarounds where you rename all your files to something predictable.
A few examples:
With a given directory path, return number of files in directory.
With a given directory path and number index, return file reference at that location in the directory.
There may be other possibilities, but only those two features would be really required for this.
Good suggestion, regarding your second point "given a number index return the file at that location" what about the sort applied? What is the use case of this? Because there is already a function to pick a random file from a directory (the "tu")
The general use case would be primitive file access, it would make certain things not require workarounds and open up new avenues in general.
An example of something I wanted to do, but couldn't do easily, is making an image gallery komponemt. To do so with the tools currently available requires the workaround of renaming all the images to numbered file names and converting them to all one file type. This is something most wouldn't want to go through as an end-user.
For the sort, I had the same questions myself. There's a few different ways it can be handled, such as: have no sorting at all, have some method of creating a directory object that is a pre-sorted list of the files, or include a sort method in the file 'pull' request.
The sort methods, if sorting is done at all, would be things like last modified, size, type. Things like that.
However, if no user-provided sort method is possible yet sorting can be done regardless, defaulting to last modified or name would likely be best for most use cases.
Thanks for your response, regardless if this gets implemented.
With the introduction of scoped storage this becomes a very different thing as i will need to basically first setup a folder global and then allow browsing that, still in roadmap