55[ ![ Coverage] ( https://coveralls.io/repos/github/lordofscripts/vfs/badge.svg?branch=main )] ( https://coveralls.io/github/lordofscripts/vfs?branch=main )
66![ GitHub go.mod Go version] ( https://img.shields.io/github/go-mod/go-version/lordofscripts/vfs )
77
8+ ![ Successful] ( ./doc/repository_logo_vfs.png )
9+
810` vfs ` is GO library to support * Virtual Filesystems* . It provides the basic
911abstractions of filesystems and implementations, like:
1012
@@ -13,38 +15,6 @@ abstractions of filesystems and implementations, like:
1315* ` dummy ` which does nothing other than outputting what file operation was
1416 called without actually modifiying the underlying file system.
1517
16- ## What's Different?
17-
18- You may have noticed this is a * forked* repository. I forked it from
19- [ 3JoB/vfs] ( https://github.com/3JoB/vfs ) which in turn is an improved fork of
20- the original ` blang/vfs ` by [ Benedikt Lang)] ( https://github.com/blang/vfs ) .
21-
22- I originally used BLang's version ` v1.0.0 ` and was satisfied with it, although I had
23- to write some extra code to accomplish what I needed. I realized I needed
24- BLang's ** Dummy** File System but improved to meet my requirements. Unfortunately,
25- after submitting several issues to the original repository, no answer came of
26- it. In fact Benedikt's repository has not been updated in 9 years! But it is
27- still quite useful in its simplicity!
28-
29- After testing my own shell object to emulate a Dummy Filesystem, I realized it
30- was better to simply enhance his original ` DummyFS ` . That's how I came across
31- ** 3JoB's** clone tagged ` v1.0.0 ` which has some enhancements over Benedikt's version:
32-
33- * Support for Symbolic Links
34- * Minor changes like using ` any ` instead of ` interface{} `
35-
36- Therefore, I decided to build upon this one instead. After all, 3JoB's version
37- was updated last year (2023).
38-
39- Is this a YAUF (Yet-Another-Useless-Fork)? well, no! I plan on making certain
40- enhancements that would make it suitable for my application out-of-the-box
41- without the need for glue structures. So, Keep tuned! But to start with:
42-
43- * Updated it to use ` main ` as branch instead of the deprecated ` master `
44- * Added ` go.mod `
45- * Included a GO workflow.
46- * Has a flexible BitBucket Filesystem ` bucketfs ` more suitable for testing
47-
4818## Usage
4919
5020``` bash
@@ -56,6 +26,12 @@ Note: Always vendor your dependencies or fix on a specific version tag.
5626import github.com /lordofscripts/vfs
5727```
5828
29+ ![ Static Badge] ( https://img.shields.io/badge/os-MacOS-blue?style=plastic&label=VFS&color=green )
30+ ![ Static Badge] ( https://img.shields.io/badge/os-Linux-blue?style=plastic&label=VFS&color=green )
31+ ![ Static Badge] ( https://img.shields.io/badge/os-Windows-blue?style=plastic&label=VFS&color=green )
32+ ![ Static Badge] ( https://img.shields.io/badge/os-Unix-blue?style=plastic&label=VFS&color=green )
33+ ![ Static Badge] ( https://img.shields.io/badge/vfs-ReadOnly-blue?style=plastic&label=VFS&color=blue )
34+
5935``` go
6036// Create a vfs accessing the filesystem of the underlying OS
6137var osfs vfs.Filesystem = vfs.OS ()
@@ -73,7 +49,11 @@ _, err := f.Write([]byte("Write on readonly fs?"))
7349if err != nil {
7450 fmt.Errorf (" Filesystem is read only!\n " )
7551}
52+ ```
53+
54+ ![ Static Badge] ( https://img.shields.io/badge/vfs-MemFS-blue?style=plastic&label=VFS&color=blue )
7655
56+ ``` go
7757// Create a fully writable filesystem in memory
7858mfs := memfs.Create ()
7959mfs.Mkdir (" /root" , 0777 )
@@ -92,7 +72,11 @@ fs.Mkdir("/memfs/testdir", 0777)
9272// This would create /tmp/testdir inside your OS fs
9373// But the rootfs `osfs` is read-only
9474fs.Mkdir (" /tmp/testdir" , 0777 )
75+ ```
76+
77+ ![ Static Badge] ( https://img.shields.io/badge/vfs-BucketFS-blue?style=plastic&label=VFS&color=blue )
9578
79+ ``` go
9680// Now use a BitBucket Filesystem in Silent mode
9781fsb1 := bucketfs.Create ()
9882fsb1.Mkdir (" /bucket/testdir" , 0777 ))
@@ -109,16 +93,17 @@ Check detailed examples below. Also check the [GoDocs](http://godoc.org/github.c
10993
11094## Why should I use this lib?
11195
112- - Only Stdlib
113- - (Nearly) Fully tested (Coverage >87%)
96+ - Pure unadulterated GO
97+ - (Nearly) Fully tested
11498- Easy to create your own filesystem
11599- Mock a full filesystem for testing (or use included ` memfs ` or ` bucketfs ` )
116100- Compose/Wrap Filesystems ` ReadOnly(OS()) ` and write simple Wrappers
117- - Many features, see [ GoDocs] ( http://godoc.org/github.com/lordofscripts/vfs ) and examples below
118101- Flexible BitBucket filesystem
119102
120103## Features and Examples
121104
105+ Many features, see [ GoDocs] ( http://godoc.org/github.com/lordofscripts/vfs ) and examples below
106+
122107- [ OS Filesystem support] ( http://godoc.org/github.com/lordofscripts/vfs#example-OsFS )
123108- [ ReadOnly Wrapper] ( http://godoc.org/github.com/lordofscripts/vfs#example-RoFS )
124109- [ DummyFS for quick mocking] ( http://godoc.org/github.com/lordofscripts/vfs#example-DummyFS )
@@ -142,9 +127,46 @@ GO libraries but many were too bloated and included other appendages I was not
142127interested in. I loved this VFS version because it had no other dependencies.
143128
144129
145- ### Contribution
130+ ## What's Different (History)?
131+
132+ The original GO-VFS repository was ` github.com/blang/vfs ` by
133+ [ Benedikt Lang)] ( https://github.com/blang/vfs ) . Which stopped at ** v1.0.0** about
134+ nine (9) years ago. It was a quite mature implementation which I was actually
135+ using in one of my projects. But it came short in emulating a Dry Run. I ended
136+ up writing my own quick & grey [ Dry Run] ( https://github.com/lordofscripts/wipechromium/blob/main/file_ops.go )
137+ for that purpose, and it worked quite well.
138+
139+ Since I was still using ` blang/vfs ` in the Unit Tests (only), I figured I might
140+ as well invest some time and integrate it fully to replace my Dry Run as a
141+ mere exercise. I started looking for better-fitting alternatives. There were none,
142+ but there were about 50+ forks of the original ` blang/vfs ` but all where just
143+ abandoned forks with no extra commits (people's fake trophies?). In that long list
144+ I came across the single fork that had actually extra commits and extra
145+ functionality.
146+
147+ So, I discovered 3JoB's fork tagged wrongly ` v1.0.0 ` when it should have been
148+ ` v1.1.0 ` because it built on the original with added functionality:
149+
150+ * Support for Symbolic Links
151+ * Support for Walk function
152+ * Minor changes like using ` any ` instead of ` interface{} `
153+
154+ But [ 3JoB/vfs] ( https://github.com/3JoB/vfs ) 's version didn't quite meet my requirements.
155+ While the original version dated from 9 years ago, 3JoB's last commit was a year
156+ ago, but it seemed to have ended there too. I decided to fork that and enhance it:
157+
158+ Is this a YAUF (Yet-Another-Useless-Fork)? well, no! I plan on making certain
159+ enhancements that would make it suitable for my application out-of-the-box
160+ without the need for glue structures. So, Keep tuned! But to start with:
161+
162+ * Updated it to use ` main ` as branch instead of the deprecated ` master `
163+ * Added ` go.mod `
164+ * Included a GO workflow for building.
165+ * Has a flexible BitBucket Filesystem ` bucketfs ` more suitable for testing
166+ * Bumped version to ` v1.2.0 ` to properly reflect new functionality beyond
167+ Benedikt's & 3JoB's.
146168
147- Feel free to make a pull request. For bigger changes create a issue first to discuss about it .
169+ In due time more changes will come .
148170
149171### License
150172
0 commit comments