fsmount

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 9 Imported by: 1

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MkdirFS added in v0.1.2

type MkdirFS interface {
	fs.FS
	Mkdir(name string, mode fs.FileMode) error
}

type MountHandle added in v0.1.2

type MountHandle interface {
	io.Closer
}

func MountFS

func MountFS(mountPoint string, fsys fs.FS, opt *MountOptions) (MountHandle, error)

type MountOptions

type MountOptions struct {
	ReadOnly   bool // Windows only: Even if the file system supports writing file, treat as read-only.
	Debug      bool // Print debug logs.
	FuseOption interface{}
}

type OpenDirFS added in v0.1.2

type OpenDirFS interface {
	fs.FS
	OpenDir(name string) (fs.ReadDirFile, error)
}

type OpenWriterFS added in v0.1.2

type OpenWriterFS interface {
	fs.FS
	OpenWriter(name string, flag int) (io.WriteCloser, error)
}

type RemoveFS added in v0.1.2

type RemoveFS interface {
	fs.FS
	Remove(name string) error
}

type RenameFS added in v0.1.2

type RenameFS interface {
	fs.FS
	Rename(name string, newName string) error
}

type TruncateFS added in v0.1.2

type TruncateFS interface {
	fs.FS
	Truncate(name string, size int64) error
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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