gitfs

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: MIT, MIT Imports: 10 Imported by: 0

README

gitfs

Go lang git http.FileSystem

Installation

$ go get github.com/dolfly/httpfs/gitfs

Usage

import "github.com/dolfly/httpfs/gitfs"

Examples

GitFS
package main

import (
	"github.com/dolfly/httpfs/gitfs"
	"net/http"
)

func main() {
	fs := gitfs.New("sites.gif", "master")

	http.Handle("/", http.FileServer(fs))
	http.ListenAndServe(":8080", nil)
}

Simple git webserver

Author

gnue

License

MIT

Documentation

Overview

Go lang git http.FileSystem

Index

Constants

View Source
const TIME_ISO = "2006-01-02 15:04:05 -0700"

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func (*File) Close

func (f *File) Close() error

func (*File) Read

func (f *File) Read(p []byte) (int, error)

func (*File) Readdir

func (f *File) Readdir(count int) (finfos []os.FileInfo, err error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Stat

func (f *File) Stat() (os.FileInfo, error)

type FileInfo

type FileInfo struct {
	// contains filtered or unexported fields
}

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (f *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (f *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (f *FileInfo) Name() string

func (*FileInfo) Size

func (f *FileInfo) Size() int64

func (*FileInfo) Sys

func (f *FileInfo) Sys() interface{}

type FileSystem

type FileSystem struct {
	Repo   *Repo
	Branch string
}

func New

func New(repo string, branch string) *FileSystem

func (*FileSystem) Open

func (g *FileSystem) Open(name string) (http.File, error)

type Object

type Object struct {
	Repo *Repo
	Id   string
}

func (*Object) Read

func (obj *Object) Read() ([]byte, error)

func (*Object) Size

func (obj *Object) Size() (int64, error)

func (*Object) Type

func (obj *Object) Type() (string, error)

type Repo

type Repo struct {
	Path string
}

func (*Repo) Exec

func (repo *Repo) Exec(args ...string) ([]byte, error)

func (*Repo) Open

func (repo *Repo) Open(fname string, treeish string) (*File, error)

func (*Repo) Stat

func (repo *Repo) Stat(fname string, treeish string) (*FileInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL