Fiber: 馃 Http.FileServer

Created on 1 Aug 2020  路  6Comments  路  Source: gofiber/fiber

How can I do something like:
http.FileServer(http.Dir("/path/to/myFolder"))
In Fiber?
Thank you

馃 Question

Most helpful comment

if I want to watch a video from mid to next, I click in the middle of the play bar.

Yeah these are range requests and our Static method supports this option ( not enabled by default )

// With static http://localhost:3000/movie.mp4
app.Static("/", "./public", fiber.Static{
  ByteRange:  true,
})

You could also use ctx.SendFile("./public/movie.mp4") where this is enabled by default

All 6 comments

Hi @bashery, yes we support static files:
https://docs.gofiber.io/app#static

We also have a middleware for embed files:
https://github.com/gofiber/fiber/blob/master/middleware/filesystem.md 馃憤

thank you very much.

I am trying to make a simple video rendering server,
The standard library provides the ability to query any piece of video. I mean, I can open the video from the first, from the middle, from the last, or from any point in time. A query and response are sent with the 200 status.
With fiber I can only play the video from the first. I cannot present it forward or inquire about any moment from the middle or the last. I do not see any request. No response to any situation.

Maybe the reason is the header information is not available on the video. I'm not sure.

Hi @bashery, do you mean range requests? Or a custom implementation to load specific parts of the video using query parameters E.g: /?range=0-500 ?

Yeah. I mean loading specific parts of the video. or loading the video beginning with certain parts. For example, if I want to watch a video from mid to next, I click in the middle of the play bar.
This is possible by default in "net/http", and without performing any custom settings for router parameters.

The idea of implementing custom router parameters seems very useful. Ability to share the most important part of the video.
Thank you very much for this idea.

if I want to watch a video from mid to next, I click in the middle of the play bar.

Yeah these are range requests and our Static method supports this option ( not enabled by default )

// With static http://localhost:3000/movie.mp4
app.Static("/", "./public", fiber.Static{
  ByteRange:  true,
})

You could also use ctx.SendFile("./public/movie.mp4") where this is enabled by default

Oh, my goodness. That's what I'm looking for. Thank you very much, @Fenny.
Sorry, I didn't ask the question clearly. Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renanbastos93 picture renanbastos93  路  3Comments

faultable picture faultable  路  3Comments

mayowa picture mayowa  路  3Comments

mewben picture mewben  路  3Comments

MohamedGouaouri picture MohamedGouaouri  路  3Comments