Documentation ¶
Overview ¶
Package ghfs wraps the github v3 rest api with io/fs. Files in the repository can be read in the same way as local files.
Example ¶
package main import ( "context" "io" "os" "github.com/johejo/ghfs" "golang.org/x/oauth2" ) func main() { ctx := context.Background() ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")}) c := oauth2.NewClient(ctx, ts) fsys := ghfs.New(c, "golang", "go") f, err := fsys.Open("README.md") if err != nil { panic(err) } io.Copy(os.Stdout, f) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is a file system using github v3 reset api. ref: https://docs.github.com/en/rest/reference/repos#get-repository-content
Click to show internal directories.
Click to hide internal directories.