Categorygithub.com/go-serve/bindatafs
modulepackage
0.0.0-20231222080822-47e16405bacb
Repository: https://github.com/go-serve/bindatafs.git
Documentation: pkg.go.dev

# README

bindatafs

Documentations GitHub Workflow results Go Report Card Coverage Status

bindatafs helps to serve go-bindata-generated assets with http.FileServer.

Install

go get -u github.com/go-serve/bindatafs

Example


package main

import (
    "net/http"

    "github.com/go-serve/bindatafs"
    "golang.org/x/tools/godoc/vfs/httpfs"
)

// FileSystem returns a Filesystem implementation for the given assets
func FileSystem() bindatafs.FileSystem {
    // assume you have Asset, AssetDir, AssetInfo are generated by go-bindata
    return bindatafs.New("assets://", Asset, AssetDir, AssetInfo)
}

func main() {
    handler := http.FileServer(httpfs.New(FileSystem()))
    http.ListenAndServe(":8080", handler)
}

For more examples, please read the Documentations.

Author

This software is written by Koala Yeung (koalay at gmail.com).

Licence

This software is licenced under the MIT License. You may obtain a copy of the licence in the LICENSE.md file in this repository.

Contributing and Bug Report

Pull requests are welcomed. Please read the CONTRIBUTING.md for details.

Bug reports are always welcome to our issue tracker.

# Packages

No description provided by the author

# Functions

New returns a FileSystem implementation of the given go-bindata generated assets.

# Structs

FileReader implements vfs.ReadSeekCloser.

# Interfaces

FileSystem is a copy of vfs interface FileSystem.

# Type aliases

AssetDirFunc is the AssetDir() function generated by go-bindata.
AssetFunc is the Assets() function generated by go-bindata.
AssetInfoFunc is the AssetInfo() function generated by go-bindata.