Currently tree() is quite limited. @Gozala proposes at #191 (comment) a more flexible API:
I find tree to be a confusing name especially since it just returns paths. I think paths or list would have being far more clear.
I also kind of wish there was a way to traverse without following every branch .traverse(cid, path, {follow:path => boolean, order:path[] => path[] }) that way traverse(cid, path) is shallow, and .traverse(cid, path, {follow:Boolean}) is recursive, but it also provides an opportunity to avoid traversing irrelevant paths. As of order it can provide a way to choose traversal scheme e.g. depth-first could be as simple as returning path with most path components first.