seems like a limitation set by Adobe
you can use require('fs') > readdir()
it will return strings/paths that you can use stats to check if is file or folder.
if you need an entry you can getEntryFromUrl with required path.
UXP doesn’t impose any hard limit but that error could be rather from the OS which limits the number of file handles that can be opened by a process. What platform are you working on and how many files are you trying to open? On Mac, for instance, you can check the number of files allowed per process by typing in
ulimit -n
and then check how many files are open by Photoshop currently by using
lsof -p <Process ID of Photoshop>|wc -l
or using the Activity Monitor application and using the tab Open Files and Ports for Photoshop.
I did it in mac and shows this:
ulimit - n
256
lsof -p 45183|wc -l
922
May be it is cumulative? Because I am not reading a lot at the same time, is like after a time using the panel, appears this message, and I have to restart Photoshop.
Can we close in some way the entry file after read?
I would double check to make sure you’re storing the file entry objects in a non-global scope, so they are eligible for garbage collection and hence can release the corresponding system resource.
in his case he’s accessing all entries in a folder and looping through them, so I guess it wont get garbage collected since it’s all stores in one big array and he is still in the same scope.
I still think it’s better practice to readdir() and loop through simple strings and only create and entry when necessary.
no need for the overhead of localfilesystem for simple name/type check.