Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get all file/folder names using streamFile method?

Millie Allen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 19, 2022

Hi,

I'm making a BitBucket plugin using Java and I'm trying to get the names of all files/folders within a repository, starting from the top level. I currently have

ByteArrayOutputStream out = new ByteArrayOutputStream();

contentService.streamFile(repo, branchName, "basic_branching", (s) -> out);

This currently gets what I want from within the basic_branching folder included in the default repository generated when creating a plugin, however I want to get the contents from the level above, the top level of the master branch. I have tried using "" and "/" in place of "basic_branching" but I get an error saying the path needs to be specified. I have also tried  req.getContextPath() and repo.getOrigin().toString(). Neither of which were what I wanted. Does anyone know the correct thing to put in here to get the contents from the top level, or is there is another method to do the same thing? Again I am only looking for the file/folder names, not the contents of the files.

Thanks

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events