Help with syscall and getdents function

In that case, how about (*File).Readdir? You oen the folder as a file (like for getdents) and then call Readdir with smaller n values (e.g. 1024) to read the entries gradually.