Documentation
¶
Overview ¶
Go lang zip http.FileSystem
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OSX_Ignore = []string{"__MACOSX", ".DS_Store"}
Functions ¶
Types ¶
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
func New ¶
func New(data []byte, opts *Options) (*FileSystem, error)
Example ¶
Simple zip webserver(use New)
package main
import (
"log"
"net/http"
"os"
"github.com/dolfly/httpfs/zipfs"
)
func main() {
b, err := os.ReadFile("public.zip")
if err != nil {
log.Fatal(err)
}
fs, err := zipfs.New(b, &zipfs.Options{Prefix: "public"})
if err != nil {
log.Fatal(err)
}
http.Handle("/", http.FileServer(fs))
http.ListenAndServe(":8080", nil)
}
type FileSystemCloser ¶
type FileSystemCloser struct {
FileSystem
Filename string
// contains filtered or unexported fields
}
func Open ¶
func Open(name string, opts *Options) (*FileSystemCloser, error)
Example ¶
Simple zip webserver(use Open)
package main
import (
"log"
"net/http"
"github.com/dolfly/httpfs/zipfs"
)
func main() {
fs, err := zipfs.Open("public.zip", &zipfs.Options{Prefix: "public"})
if err != nil {
log.Fatal(err)
}
defer fs.Close()
http.Handle("/", http.FileServer(fs))
http.ListenAndServe(":8080", nil)
}
func (*FileSystemCloser) Close ¶
func (z *FileSystemCloser) Close() error
Click to show internal directories.
Click to hide internal directories.