Ability to read assets from public folder
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Describe the feature
Would love to be able to get access to the assets variable that is created on build
For example:
const assets = {
"/success.html": {
"type": "text/html; charset=utf-8",
"etag": "\"7-i5KKyIzUGAhxNMutZtRIycH0cTo\"",
"mtime": "2025-10-27T22:40:48.992Z",
"size": 7,
"path": "../public/success.html"
}
};
What I'm dreaming of is being able to do something like this:
const fileContents = await useStorage('public:server').getItemRaw('success.html')
const meta = await useStorage('public:server').getMeta('success.html')
// Do some stuff with file...
setResponseHeader(event, 'content-type', meta.type)
return fileContents
I can of course do something similar with custom server assets but then I need to figure out the content type header on my own, feels like the all data is right there I just can't get access to it. Another option would be to export readAsset for end users. Thoughts?
Additional information
- Would you be willing to help implement this feature?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the build-created assets variable and the public folder are handled, then inspect the existing useStorage('public:server') entry point and the proposed readAsset API. Confirm how raw contents and metadata would be exposed, including content type, and add coverage for reading public/success.html if the project has a suitable test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100