You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to express, it would be great for Hono to have a sendFilefunction to complement serveStatic. There's a lot of custom logic that goes into serving a static file (as evidence'd by the serveStatic function), but you don't always want to just serve a static directory with predetermined paths - in a lot of cases, you may want to dynamically figure out which file to send. It's easy to just read the file into memory and send it along, but it's better to be able to support ranges, mime types, etc. automatically.
I think this api would probably look like:
import{sendFile}from'@hono/node-server/send-file'// ...app.get("/my-path",(c)=>{// Can accept options similar to `serveStatic`returnsendFile(c,filePath,{ ...options})})
The text was updated successfully, but these errors were encountered:
Similar to express, it would be great for Hono to have a
sendFile
function to complementserveStatic
. There's a lot of custom logic that goes into serving a static file (as evidence'd by theserveStatic
function), but you don't always want to just serve a static directory with predetermined paths - in a lot of cases, you may want to dynamically figure out which file to send. It's easy to just read the file into memory and send it along, but it's better to be able to support ranges, mime types, etc. automatically.I think this api would probably look like:
The text was updated successfully, but these errors were encountered: