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
I've stumbled upon this interesting package during my research on how to serve contents of iso file over http.
Definitely, I could loop-mount it and just serve static files from mount point, but the idea of implementing it completely in go took me over.
So, my web part is implemented using gin-gonik and it has a very handy FileFromFS method, that operates through standard io.FS interface.
I'm quite a new gopher and do not have enough knowlegde to improve such a big go projects, so I've started with a wrapper around go-diskfs. It, actually work, but, it's very much suboptimal in many ways as it does not have access to the internals of this project.
If this would be implemented, the actual code of serving files from iso will boil down to the following:
funcmain() {
app:=gin.Default()
disk, err:=diskfs.Open("/path/to/image.iso")
iferr!=nil {
log.Fatalf("failed to open file: %s", err)
}
isofs, err:=disk.GetFilesystem(0)
iferr!=nil {
log.Fatalf("failed to get partition 0: %s", err)
}
app.GET("/iso/*path", func(c*gin.Context) {
c.FileFromFS(c.Param("path"), http.FS(isofs))
})
a.Run(":8080")
}
Any help will be appreciated!
If you're interested in the idea behind this - it's quite trivial: to serve linux distribution repos from the iso file over http for group access.
The text was updated successfully, but these errors were encountered:
Sorry for being unclear, @deitch At some point of digging different sources it seemed to me that io.FS is an alias to fs.FS..
So, yes, it is fs.FS that is needed to be provided.
I don't see how it is suboptimal.
Again, to clarify a bit: my implementation appeared suboptimal as it is mostly a wrapper around go-diskfs providing missing methods. And as some structures (directoryEntry, for example) are not exported from go-diskfs, I had to reinvent the wheel in my wrapper..
I've stumbled upon this interesting package during my research on how to serve contents of iso file over http.
Definitely, I could loop-mount it and just serve static files from mount point, but the idea of implementing it completely in go took me over.
So, my web part is implemented using gin-gonik and it has a very handy FileFromFS method, that operates through standard io.FS interface.
I'm quite a new gopher and do not have enough knowlegde to improve such a big go projects, so I've started with a wrapper around go-diskfs. It, actually work, but, it's very much suboptimal in many ways as it does not have access to the internals of this project.
If this would be implemented, the actual code of serving files from iso will boil down to the following:
Any help will be appreciated!
If you're interested in the idea behind this - it's quite trivial: to serve linux distribution repos from the iso file over http for group access.
The text was updated successfully, but these errors were encountered: