{"id":13714155,"url":"https://github.com/iand/mfsng","last_synced_at":"2025-04-19T21:37:39.889Z","repository":{"id":36967810,"uuid":"467097032","full_name":"iand/mfsng","owner":"iand","description":"An implementation of Go's filesystem interface for the IPFS UnixFS format.","archived":false,"fork":false,"pushed_at":"2024-03-14T10:51:02.000Z","size":142,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T07:26:54.533Z","etag":null,"topics":["go","ipfs"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2022-03-07T13:03:40.000Z","updated_at":"2023-10-29T18:42:38.000Z","dependencies_parsed_at":"2023-11-29T10:29:27.154Z","dependency_job_id":"a11fc391-b377-47d9-a3db-c38dca800f05","html_url":"https://github.com/iand/mfsng","commit_stats":{"total_commits":44,"total_committers":3,"mean_commits":"14.666666666666666","dds":0.5,"last_synced_commit":"3f1d946d85b1c4d1e3995236dbbea4960efd4787"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iand%2Fmfsng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iand%2Fmfsng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iand%2Fmfsng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iand%2Fmfsng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iand","download_url":"https://codeload.github.com/iand/mfsng/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232404859,"owners_count":18517985,"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","ipfs"],"created_at":"2024-08-02T23:01:53.575Z","updated_at":"2025-01-03T23:03:29.150Z","avatar_url":"https://github.com/iand.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# mfsng\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/iand/mfsng)\n\nAn implementation of Go's filesystem interface for the IPFS UnixFS format.\n\n## Overview\n\n`mfsng` is an implementation of [fs.FS](https://pkg.go.dev/io/fs#FS) over a [UnixFS](https://github.com/ipfs/specs/blob/master/UNIXFS.md) merkledag.\n\n\n## Example Usage\n\nIn this example `printFile` prints the file `folder/hello.txt` held in the UnixFS represented by the supplied [ipld.Node](https://pkg.go.dev/github.com/ipld/go-ipld-prime#Node).\n`getter` is something that implements [ipld.NodeGetter](https://pkg.go.dev/github.com/ipfs/go-ipld-format#NodeGetter), such as a [DagService](https://pkg.go.dev/github.com/ipfs/go-merkledag#NewDAGService)\n\n```Go\nfunc printFile(node ipld.Node, getter ipld.NodeGetter) {\n\tfsys, err := mfsng.ReadFS(node, getter)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create fs: %v\", err)\n\t}\n\n\tf, err := fsys.Open(\"folder/hello.txt\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to open file: %v\", err)\n\t}\n\tdefer f.Close()\n\n\tdata, err := io.ReadAll(f)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to read file: %v\", err)\n\t}\n\n\tfmt.Println(string(data))\n}\n```\n\nThis example demonstrates how the FS can be used with Go's standard walk function and shows how the underlying CID can\nbe obtained for a file.\n\n```Go\nfunc walkFiles(node ipld.Node, getter ipld.NodeGetter) {\n\tfsys, err := mfsng.ReadFS(node, getter)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create fs: %v\", err)\n\t}\n\tif err := fs.WalkDir(fsys, \".\", func(path string, de fs.DirEntry, rerr error) error {\n\t\tif de.IsDir() {\n\t\t\tfmt.Printf(\"D %s\\n\", path)\n\t\t} else {\n\t\t\tf := de.(*mfsng.File)\n\t\t\tfmt.Printf(\"F %s (cid=%s)\\n\", path, f.Cid())\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn log.Fatalf(\"failed walk: %v\", err)\n\t}\n}\n```\n\nAn example of using the FS with Go's Glob functionality:\n```Go\nfunc matchFiles(node ipld.Node, getter ipld.NodeGetter) {\n\tfsys, err := mfsng.ReadFS(node, getter)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create fs: %v\", err)\n\t}\n\tmatches, err := fs.Glob(fsys, \"some/*/folder/*.txt\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to glob: %v\", err)\n\t}\n\n\tfor _, match := range matches {\n\t\tfmt.Println(match)\n\t}\n}\n```\n\n## Status\n\nThis package is experimental. It has a number of limitations:\n\n - Read only\n - No support for symlinks.\n - No support for modtimes since they are not exposed by go-unixfs (but see [go-unixfs#117](https://github.com/ipfs/go-unixfs/pull/117))\n\nAdding write capabilities is planned but some thought is needed around the API since there is no official one (although see [go#issue-45757](https://github.com/golang/go/issues/45757) for some discussion).\nWrite capabilities are under development in the [writefs branch](https://github.com/iand/mfsng/tree/writefs).\n\n## Contributing\n\nWelcoming [new issues](https://github.com/iand/mfsng/issues/new) and [pull requests](https://github.com/iand/mfsng/pulls).\n\n## License\n\nThis software is dual-licensed under Apache 2.0 and MIT terms:\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/filecoin-project/sentinel-visor/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](https://github.com/filecoin-project/sentinel-visor/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiand%2Fmfsng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiand%2Fmfsng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiand%2Fmfsng/lists"}