GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - schmidtw/githubfs: A go fs.FS based github filesystem.

BranchesTags
Open more actions menu

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.reuse
.reuse
 
 
LICENSES
LICENSES
 
 
examples/simple
examples/simple
 
 
tarballs
tarballs
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
MAINTAINERS.md
MAINTAINERS.md
 
 
README.md
README.md
 
 
dir.go
dir.go
 
 
dir_test.go
dir_test.go
 
 
dirent.go
dirent.go
 
 
dirent_test.go
dirent_test.go
 
 
dirhandle.go
dirhandle.go
 
 
dirhandle_test.go
dirhandle_test.go
 
 
example_test.go
example_test.go
 
 
file.go
file.go
 
 
file_test.go
file_test.go
 
 
filehandle.go
filehandle.go
 
 
filehandle_test.go
filehandle_test.go
 
 
fileinfo.go
fileinfo.go
 
 
fileinfo_test.go
fileinfo_test.go
 
 
ghe_v3.3.go
ghe_v3.3.go
 
 
githubfs.go
githubfs.go
 
 
githubfs_test.go
githubfs_test.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 

Repository files navigation

githubfs

CI codecov.io Go Report Card GitHub Release GoDoc

A simple to use go fs.FS based github filesystem.

Resulting Directory Structure

org_or_user/                    // org or username
└── repository                  // repository
    ├── git                     // fixed name 'git'
    │   └── main                // the branch name
    │       └── README.md       // the files in the repo
    └── releases                // fixed name 'releases'
        └── v0.0.1              // release version
            └── description.md  // the description of the release and other files from the release

Example Usage

package githubfs

import (
	"context"
	"fmt"
	"io/fs"
	"os"

	"github.com/schmidtw/githubfs"
	"golang.org/x/oauth2"
)

func main() {
	src := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
	)
	httpClient := oauth2.NewClient(context.Background(), src)

	gfs := githubfs.New(
		githubfs.WithHttpClient(httpClient),
		githubfs.WithRepo("schmidtw", "githubfs"),
	)

	err := fs.WalkDir(gfs, "schmidtw/githubfs/git/main/.reuse",
		func(path string, d fs.DirEntry, err error) error {
			fmt.Printf("%s\n", path)
			if err != nil || d.IsDir() {
				return err
			}

			return nil
		})
	if err != nil {
		panic(err)
	}
}

Limitations

  • Symlinks are only supported for files fetched for small repos (where the fetch occurs via a tarball).
  • Packages are not supported by the github graphql API, so they aren't supported here.
  • Gists are not supported presently.

About

A go fs.FS based github filesystem.

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.