Browse content of a folder/container


#1

Hi,

I’m working on a server side app and I want to open/load a folder/container and show it’s contents.
I’m trying to do this with the rdflib.js (https://github.com/linkeddata/rdflib.js)
How could this be achieved?

Thanks in advance!

Regards
Simon


#2

You can either use solid-file-client’s readFolder() method which returns an array of file objects including name, size, etc… Or, directly with rdflib, this will put the folder’s contents into an array of file names and then you’d have to iterate over to it get each file’s details.

let store = $rdf.graph();
// ... fetch the folder 
let folderItems = store.each(
     $rdf.sym( folderAddress ),
     $rdf.sym('http://www.w3.org/ns/ldp#contains'),
     null
 );

#3

that was fast - thank you!
works perfectly!