{"id":22340026,"url":"https://github.com/mandelsoft/vfs","last_synced_at":"2025-07-30T00:31:30.323Z","repository":{"id":50771544,"uuid":"292052020","full_name":"mandelsoft/vfs","owner":"mandelsoft","description":"Virtual Filesystem for Go","archived":false,"fork":false,"pushed_at":"2024-11-16T19:58:22.000Z","size":3004,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T20:28:03.444Z","etag":null,"topics":["go","golang","golang-library","vfs","virtual-file-system"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mandelsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-01T16:37:05.000Z","updated_at":"2024-11-16T19:58:26.000Z","dependencies_parsed_at":"2023-02-09T20:46:12.387Z","dependency_job_id":"b4da1f28-9cb5-46be-9cd0-24f379ba2091","html_url":"https://github.com/mandelsoft/vfs","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fvfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fvfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fvfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fvfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mandelsoft","download_url":"https://codeload.github.com/mandelsoft/vfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228061810,"owners_count":17863374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","golang-library","vfs","virtual-file-system"],"created_at":"2024-12-04T07:10:12.230Z","updated_at":"2024-12-04T07:10:12.985Z","avatar_url":"https://github.com/mandelsoft.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## VFS - A Virtual Filesystem for GO\n\n\n[![CI Build status](https://app.travis-ci.com/mandelsoft/vfs.svg?branch=master)](https://app.travis-ci.com/github/mandelsoft/vfs)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mandelsoft/vfs)](https://goreportcard.com/report/github.com/mandelsoft/vfs)\n\n\nA virtual filesystem enables programs to transparently work on any kind\nof filesystem-like data source besides the real operating system filesystem\nusing a uniform single API.\n\nThis project provides an API that can be used instead of the native \nOS filesytem API. Below this API there might be several technical\nimplementations that simulate a uniform filesystem for all its users.\n\n- package `osfs` provides access to the real operating system filesystem\n  observing the current working directory (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/osfs)).\n- package `memoryfs` provides a pure memory based file system supporting\n  files, directories and symbolic links (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/memoryfs)).\n- package `composefs` provides a virtual filesystem composable of\n  multiple other virtual filesystems, that can be mounted on top of\n  a root file system (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/composefs)).\n- package `layerfs` provides a filesystem layer on top of a base filesystem.\n  The layer can be implemented by any other virtual filesystem, for example\n  a memory filesystem (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/layerfs)).\n- package `yamlfs` provides a filesystem based on the structure and content of a\n  yaml document (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/yamlfs)).\n  The document can even be changed by filesystem operations.\n  \nBesides those new implementations for a virtual filesystem there are \nsome implementation modifying the bahaviour of a base filesystem:\n\n- package `readonlyfs` provides a read-only view of a base filesystem (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/readonlyfs)).\n- package `cwdfs` provides the notion of a current working directory for\n  any base filesystem (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/cwdfs)).\n- package `projectionfs` provides a filesystem based on a dedicated directory\n  of a base filesystem (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/projectionfs)).\n  \nAll the implementation packages provide some `New` function to create an\ninstance of the dedicated filesystem type.\n\nTo work with the OS filesystem just create an instance of\nthe `osfs`:\n\n```golang\n  import \"github.com/mandelsoft/vfs/pkg/osfs\"\n\n  ...\n\n  fs := osfs.New()\n```\n\nNow the standard go filesystem related `os` API can be used just by replacing\nthe package `os` by the instance of the virtual filesystem.\n\n```golang\n\n  f, err := fs.Open()\n  if err!=nil {\n    return nil, err\n  }\n  defer f.Close()\n  return ioutil.ReadAll(f)\n```\n\nTo support this the package `vfs` provides a common interface `FileSystem` that \noffers methods similar to the `os` file operations. Additionally an own\n`File` interface is provided that replaces the struct `os.File` for the use\nin the context of the virtual filesystem. (see [godoc](https://pkg.go.dev/github.com/mandelsoft/vfs/pkg/vfs))\n\nA `FileSystem` may offer a temp directory and a current working directory.\nThe typical implementations for new kinds of a filesystem do not provide\nthese features, they rely on the orchestration with dedicated implementations,\nfor example a `cwdfs.WorkingDirectoryFileSystem` or a\n`composedfs.ComposedFileSystem`, which allows mounting a temporary filesystem.\nThe package `osfs` supports creating a temporary os filesystem based\nvirtual filesystem residing in a temporary operating system directory.\n\n### Extended VFS interface\n\nAdditionally, the interface `VFS` includes the standard filesystem operations\nand some implementation independent utility functions based on a virtual\nfilesystem known from the `os`, `ìoutil` and `filepath` packages.\nThe function `vfs.New(fs)` can be used to create such a wrapper for\nany virtual filesystem.\n\n### Support for `io/fs.FS`\n\nA virtual filesystem can be used as `io/fs.FS` or `io/fs.ReadDirFS`.\nBecause of the Go type system and the stripped interface `io/fs.File`,\nthis is not directly possible. But any virtual filesystem can be converted\nby a type converting wrapper function `vfs.AsIoFS(fs)`.\n\n### Relation to the Operating Filesystem\n\nThe operating system filesystem can be accessed using `osfs.New` or the filesystem `osfs.OsFs`. If filesystems are composed using a layered or projection filesystem, the operating system filesystem can be combined with other implementations. To figure out, whether a virtual file is backed by an operating system file, the utility function `utils.OSFile` can be used to determine the underlying operating system file. It returns `nil` if the file has no underlying operating system file. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmandelsoft%2Fvfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmandelsoft%2Fvfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmandelsoft%2Fvfs/lists"}