ghfs

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 13 Imported by: 6

README

ghfs build

:octocat: ghfs implements the io/fs interfaces for GitHub remote repositories.

The implementation wraps go-github client and use Git Database API.

Supported interface

Usage

package main

import (
	"fmt"
	"io"
	"log"

	"github.com/k1LoW/ghfs"
)

func main() {
	fsys, err := ghfs.New("golang", "time")
	if err != nil {
		log.Fatal(err)
	}
	f, err := fsys.Open("README.md")
	if err != nil {
		log.Fatal(err)
	}
	b, err := io.ReadAll(f)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", b)
}

References

  • johejo/ghfs: Package ghfs wraps the github v3 rest api with io/fs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

func New

func New(owner, repo string, opts ...Option) (*FS, error)

func (*FS) Open

func (fsys *FS) Open(name string) (fs.File, error)

func (*FS) ReadDir

func (fsys *FS) ReadDir(name string) ([]fs.DirEntry, error)

func (*FS) ReadFile

func (fsys *FS) ReadFile(name string) ([]byte, error)

func (*FS) Sub added in v0.5.0

func (fsys *FS) Sub(dir string) (fs.FS, error)

type Option added in v0.3.0

type Option func(*config) error

func Branch added in v0.4.0

func Branch(branch string) Option

func Client added in v0.3.0

func Client(client *github.Client) Option

func Context added in v0.3.0

func Context(ctx context.Context) Option

func Tag added in v0.4.0

func Tag(tag string) Option

Jump to

Keyboard shortcuts

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