-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to return a blob for getItemRaw
(http driver)
#435
Comments
Please issue issues to explain why not how 🙏🏼 (eg: a user code example or reproduction) |
responseType
to use blob for getItemRaw
getItemRaw
(http driver)
@pi0 Of course! WhyBecause if you want to fetch binary files, such as images from the http server The goal would be doing something like this in the browser (or whereever) with the server running on the HTTP server of unstorage: const storage = createStorage({
driver: httpDriver({ base: "/api/storage" }),
});
const getItem = async () => {
const blob = await storage.getItemRaw(name.value, {
responseType: 'blob'
})
const url = URL.createObjectURL(blob)
// do more with the URL
} "server part"
Other ideasRight now, there is no way to change the response type being a blob, hence the binary files cannot be used easily.
If you have a better idea on solving this problem, please let me know 😋 |
Thanks for explaining. I think it makes sense but we should consider implementing a driver-agnostic
In the meantime, I would suggest you directly use fetch for the HTTP driver if need blob access. Let's track this via #142 👍🏼 (I have updated undio note in there) |
Makes sense! Thanks for the explanation |
Describe the feature
To fetch binary files (e.g. images), using a blob response would be helpful for the http driver
A simple and optional implementation could be:
Additional information
Referencing #142 for this too :)
The text was updated successfully, but these errors were encountered: