MCPcopy Create free account
hub / github.com/go-git/go-billy

github.com/go-git/go-billy @v5.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.9.0 ↗ · + Follow

The missing interface filesystem abstraction for Go

632 symbols 2,437 edges 45 files ⚖ Apache-2.0 105 documented · 17% 147 cross-repo links ● updated 3d agolatest release v6.0.0-beta.1 · 2026-10-02★ 43415 open issues

Browse by type

⨍ Functions 567◇ Types & classes 65
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

go-billy GoDoc Test

The missing interface filesystem abstraction for Go. Billy implements an interface based on the os standard library, allowing to develop applications without dependency on the underlying storage. Makes it virtually free to implement mocks and testing over filesystem operations.

Billy was born as part of go-git/go-git project.

Version support

go-billy v5 is in maintenance mode. Users should upgrade to go-billy v6 where possible.

Installation

import "github.com/go-git/go-billy/v5" // with go modules enabled (GO111MODULE=on or outside GOPATH)
import "github.com/go-git/go-billy" // with go modules disabled

Usage

Billy exposes filesystems using the Filesystem interface. Each filesystem implementation gives you a New method, whose arguments depend on the implementation itself, that returns a new Filesystem.

The following example caches in memory all readable files in a directory from any billy's filesystem implementation.

func LoadToMemory(origin billy.Filesystem, path string) (*memory.Memory, error) {
    memory := memory.New()

    files, err := origin.ReadDir("/")
    if err != nil {
        return nil, err
    }

    for _, file := range files {
        if file.IsDir() {
            continue
        }

        src, err := origin.Open(file.Name())
        if err != nil {
            return nil, err
        }

        dst, err := memory.Create(file.Name())
        if err != nil {
            return nil, err
        }

        if _, err = io.Copy(dst, src); err != nil {
            return nil, err
        }

        if err := dst.Close(); err != nil {
            return nil, err
        }

        if err := src.Close(); err != nil {
            return nil, err
        }
    }

    return memory, nil
}

Why billy?

The library billy deals with storage systems and Billy is the name of a well-known, IKEA bookcase. That's it.

License

Apache License Version 2.0, see LICENSE

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 437
Function 130
Struct 48
Interface 13
TypeAlias 3
FuncType 1

Languages

Go100%

Modules by API surface

memfs/memory.go54 symbols
fs.go37 symbols
helper/chroot/chroot.go36 symbols
osfs/os_bound.go26 symbols
helper/mount/mount.go26 symbols
osfs/os_chroot.go19 symbols
helper/iofs/iofs.go18 symbols
memfs/storage.go16 symbols
helper/polyfill/polyfill.go14 symbols
util/util.go12 symbols
osfs/os.go10 symbols
util/glob.go5 symbols

For agents

$ claude mcp add --transport http codehub https://codehub.bot/mcp

One hosted endpoint, no key: your agent can search, read and trace go-git/go-billy and every other graph here. Cursor, Windsurf and other clients →

⬇ download graph artifact

Ask about this repo answers extend the page