Description
vfs is library to support virtual filesystems. It provides basic abstractions of filesystems and implementations, like OS accessing the file system of the underlying OS and memfs a full filesystem in-memory.
vfs for golang alternatives and similar packages
Based on the "Miscellaneous" category.
Alternatively, view vfs for golang alternatives based on common mentions on social networks and blogs.
-
go-formatter
Implements replacement fields surrounded by curly braces {} format strings. -
golang-standards/project-layout
Set of common historical and emerging project layout patterns in the Go ecosystem. -
gopsutil
A cross-platform library for retrieving process and system utilization(CPU, Memory, Disks, etc). -
go.uuid
Implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. -
archiver
Library and command for making and extracting .zip and .tar.gz archives -
fx
A dependency injection based application framework for Go (built on top of dig). -
go-multierror
A Go (golang) package for representing a list of errors as a single error. -
base64Captcha
Base64captch supports digit, number, alphabet, arithmetic, audio and digit-alphabet captcha. -
xstrings
A collection of useful string functions ported from other languages. -
modern-go-application
Go application boilerplate and example applying modern practices. -
notify
File system event notification library with simple API, similar to os/signal. -
go-shortid
Distributed generation of super short, unique, non-sequential, URL friendly IDs. -
go-restful-api
An idiomatic Go RESTful API starter kit following SOLID principles and Clean Architecture with a common project layout. -
cookiecutter-golang
A Go application boilerplate template for quick starting projects following production best practices. -
ghorg
Quickly clone an entire org/users repositories into one directory -
wuid
An extremely fast unique number generator, 10-135 times faster than UUID. -
conv
Package conv provides fast and intuitive conversions across Go types. -
gotoprom
Type-safe metrics builder wrapper library for the official Prometheus client. -
antch
A fast, powerful and extensible web crawling & scraping framework. -
Tideland Go
The Tideland Go Library contains a larger set of useful Google Go packages for different purposes. -
shoutrrr
Notification library providing easy access to various messaging services like slack, mattermost, gotify and smtp among others. -
go-sarah
A framework to build bot for desired chat services including LINE, Slack, Gitter and more. -
healthcheck
An opinionated and concurrent health-check HTTP handler for RESTful services. -
container
A powerful IoC Container with fluent and easy-to-use interface. -
stats
Monitors Go MemStats + System stats such as Memory, Swap and CPU and sends via UDP anywhere you want for logging etc... -
go-unarr
Decompression library for RAR, TAR, ZIP and 7z archives. -
golang-templates/seed
Go application GitHub repository template. -
scaffold
Scaffold generates starter Go project layout. Lets you focus on business logic implemeted.
Scout APM - Leading-edge performance monitoring starting at $39/month
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of vfs for golang or a related project?
README
vfs for golang

vfs is library to support virtual filesystems. It provides basic abstractions of filesystems and implementations, like OS
accessing the file system of the underlying OS and memfs
a full filesystem in-memory.
Usage
$ go get github.com/blang/vfs
Note: Always vendor your dependencies or fix on a specific version tag.
import github.com/blang/vfs
// Create a vfs accessing the filesystem of the underlying OS
var osfs vfs.Filesystem = vfs.OS()
osfs.Mkdir("/tmp", 0777)
// Make the filesystem read-only:
osfs = vfs.ReadOnly(osfs) // Simply wrap filesystems to change its behaviour
// os.O_CREATE will fail and return vfs.ErrReadOnly
// os.O_RDWR is supported but Write(..) on the file is disabled
f, _ := osfs.OpenFile("/tmp/example.txt", os.O_RDWR, 0)
// Return vfs.ErrReadOnly
_, err := f.Write([]byte("Write on readonly fs?"))
if err != nil {
fmt.Errorf("Filesystem is read only!\n")
}
// Create a fully writable filesystem in memory
mfs := memfs.Create()
mfs.Mkdir("/root", 0777)
// Create a vfs supporting mounts
// The root fs is accessing the filesystem of the underlying OS
fs := mountfs.Create(osfs)
// Mount a memfs inside /memfs
// /memfs may not exist
fs.Mount(mfs, "/memfs")
// This will create /testdir inside the memfs
fs.Mkdir("/memfs/testdir", 0777)
// This would create /tmp/testdir inside your OS fs
// But the rootfs `osfs` is read-only
fs.Mkdir("/tmp/testdir", 0777)
Check detailed examples below. Also check the GoDocs.
Why should I use this lib?
- Only Stdlib
- (Nearly) Fully tested (Coverage >90%)
- Easy to create your own filesystem
- Mock a full filesystem for testing (or use included
memfs
) - Compose/Wrap Filesystems
ReadOnly(OS())
and write simple Wrappers - Many features, see GoDocs and examples below
Features and Examples
- OS Filesystem support
- ReadOnly Wrapper
- DummyFS for quick mocking
- MemFS - full in-memory filesystem
- MountFS - support mounts across filesystems
Current state: ALPHA
While the functionality is quite stable and heavily tested, interfaces are subject to change.
You need more/less abstraction? Let me know by creating a Issue, thank you.
Motivation
I simply couldn't find any lib supporting this wide range of variation and adaptability.
Contribution
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
License
See [LICENSE](LICENSE) file.
*Note that all licence references and agreements mentioned in the vfs for golang README section above
are relevant to that project's source code only.