Mark
unread,Dec 15, 2020, 4:27:38 PM12/15/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Christian Crawford, Ted Blackman, Jon Shapiro, urbit-dev
Christian is right, landscape uses /app/file-server for most of its file-serving needs these days. Assuming you're trying to serve some content over HTTP, you will probably want to do something similar. Most relevant is this bit:
https://github.com/urbit/urbit/blob/6499eb5fe0bd81c91f12d6f9ebcc6843b2ca7ac7/pkg/arvo/app/file-server.hoon#L209-L229
Instead of compiling the data we serve into the app, it is more common nowadays to scry (using .^) the data out of clay when you need it. Note how, on line 215, we first check if the file we were asked to serve exists. Then, on line 216, we actually get its contents.
(We get its contents from the scry as an atom. If the kind of file (ie, the mark) that you're scrying for contains data of some other shape, you'll want to adjust accordingly.)
Then, starting on line 218, we wrap the content we got into an actual http response.
To answer your original question, note that because we try to serve the files _on demand_, there's no need to find all files in the directory ahead of time.
—
~palfun-foslup
https://urbit.org