Skip to content

binzume/fsmount

Repository files navigation

Simple FUSE bindings for Go fs.FS

Build Status Go Reference license

This library is just a wrapper to easily mount fs.FS as a filesystem.

Dependencies:

Usage

Setup FUSE

Windows:

winget install dokan-dev.Dokany

Linux(Ubuntu)

apt install fuse

examples/simple/simple.go

package main

import (
	"os"
	"github.com/binzume/fsmount"
)

func main() {
	mount, _ := fsmount.MountFS("X:", os.DirFS("."), nil)
	defer mount.Close()

	// Block forever
	select {}
}

How to create a writable FS?

See examples/writable/writable.go

go run ./examples/writable testdir R:
type WritableFS interface {
	fs.FS
	OpenWriter(name string, flag int) (io.WriteCloser, error)
	Truncate(name string, size int64) error
}

Other interfaces such as RemoveFS, MkdirFS, RenameFS... are also available.

License

MIT

About

Simple FUSE interface for Go io/fs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages