My Question is similar to this one how to get a list of files in a google cloud storage folder using node js.
Only I am trying to just get the top level objects. I am trying to follow along here nodejs storage samples files.js, and when I try different combinations of "prefix" and "deliminator" I am having a hard time just getting the top level objects. I have tried a prefix of "" with a deliminator of "/". I have tried a prefix of "/" with a deliminator of "/". I tried a prefix of "/" with no deliminator. Nothing seems to work to allow me to get just a list of the top level objects. I seem to always get all files in the entire bucket. Any ideas on what the correct parameters for prefix and deliminator that might work? Are there other options that I am not aware of that could help?
To be a little more specific, given the following blobs:
- folder1/file1.txt
- folder2/file2.txt
I just want
- folder1/
- folder2/
A couple of things I have tried:
prefix: "", deliminator: "", results:
- folder1/
- folder1/file1.txt
- folder2/
- folder2/file2.txt
prefix: "", deliminator: "/", results:
- No results...
Prefix: "/", deliminator: "", results:
- No results...
Prefix: "/", deliminator: "/", results:
- No results...
Prefix: "folder1/", deliminator: "", results:
- folder1/
- folder1/file1.txt
... as I would expect; however again I cannot figure out the right combination of prefix and deliminator to just get the two top object results that I want:
- folder1/
- folder2/