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
You don't need to use arraybuffer and await #3
Comments
Since I am planning on adding support for Accept-Ranges, shouldn't I keep using array buffers anyway? |
first export default {
fetch: async (req)=>{
let fb = await Bun.file("myfile").arrayBuffer()
return new Response(fb,{status:200})
}
} second export default {
fetch: async (req)=>{
let fb = Bun.file("myfile")
return new Response(fb,{status:200})
}
}
file |
But, if you dont use await it work faster export default {
fetch: async (req) => {
return new Promise(rs => {
Bun.file("myfile").arrayBuffer().then(arbf => {
return new Response(arbf, {
status: 200
})
}).then(rs)
})
}
}
|
Thanks! I merged your PR :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
serve-static-bun/lib/serve-static.ts
Lines 143 to 157 in ab71176
You don't need to use arraybuffer and await. I used it in my code because oven-sh/bun#616
https://github.com/gornostay25/svelte-adapter-bun/blob/b3e7449100216d2e72564d137c6c682c42c01507/src/sirv.js#L99-L102
The text was updated successfully, but these errors were encountered: