{"id":15638963,"url":"https://github.com/liamg/memoryfs","last_synced_at":"2025-04-04T22:05:14.147Z","repository":{"id":38312607,"uuid":"476057500","full_name":"liamg/memoryfs","owner":"liamg","description":":brain: :file_cabinet: In-memory filesystem implementation of io/fs.FS","archived":false,"fork":false,"pushed_at":"2023-08-30T13:56:09.000Z","size":33,"stargazers_count":89,"open_issues_count":6,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T21:03:30.945Z","etag":null,"topics":["filesystem","in-memory","in-memory-filesystem"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/liamg/memoryfs","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liamg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["liamg"]}},"created_at":"2022-03-30T21:30:34.000Z","updated_at":"2025-01-28T14:38:24.000Z","dependencies_parsed_at":"2024-06-18T14:03:33.457Z","dependency_job_id":null,"html_url":"https://github.com/liamg/memoryfs","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fmemoryfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fmemoryfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fmemoryfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liamg%2Fmemoryfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liamg","download_url":"https://codeload.github.com/liamg/memoryfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"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":["filesystem","in-memory","in-memory-filesystem"],"created_at":"2024-10-03T11:24:12.537Z","updated_at":"2025-04-04T22:05:14.126Z","avatar_url":"https://github.com/liamg.png","language":"Go","funding_links":["https://github.com/sponsors/liamg"],"categories":[],"sub_categories":[],"readme":"# memoryfs\n\n\u003cimg width=\"20%\" align=\"right\" src=\"https://i.giphy.com/media/SuEFqeWxlLcvm/giphy.webp\" /\u003e\n\nAn in-memory filesystem implementation of io/fs.FS.\n\n`memoryfs` implements all of the currently defined `io/fs` interfaces:\n\n- [fs.FS](https://pkg.go.dev/io/fs#FS)\n- [fs.GlobFS](https://pkg.go.dev/io/fs#GlobFS)\n- [fs.ReadDirFS](https://pkg.go.dev/io/fs#ReadDirFS)\n- [fs.ReadFileFS](https://pkg.go.dev/io/fs#ReadFileFS)\n- [fs.StatFS](https://pkg.go.dev/io/fs#StatFS)\n- [fs.SubFS](https://pkg.go.dev/io/fs#SubFS)\n\nIt also allows the creation of files and directories.\n\n## Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"io/fs\"\n\n    \"github.com/liamg/memoryfs\"\n)\n\nfunc main() {\n\n    memfs := memoryfs.New()\n\n    if err := memfs.MkdirAll(\"my/dir\", 0o700); err != nil {\n        panic(err)\n    }\n\n    if err := memfs.WriteFile(\"my/dir/file.txt\", []byte(\"hello world\"), 0o600); err != nil {\n        panic(err)\n    }\n\n    data, err := fs.ReadFile(memfs, \"my/dir/file.txt\")\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(string(data))\n}\n```\n\n## Lazy Loading\n\nIf you are mirroring a disk file-system in memory, it can become very inefficient when large files are in use. For this scenario, the [WriteLazyFile](https://pkg.go.dev/github.com/liamg/memoryfs#FS.WriteLazyFile) method is recommended. It allows you to add a file whose content will be provided on-demand by calling the [LazyOpener](https://pkg.go.dev/github.com/liamg/memoryfs#LazyOpener) function.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamg%2Fmemoryfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliamg%2Fmemoryfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliamg%2Fmemoryfs/lists"}