{"id":19114603,"url":"https://github.com/aligator/gofat","last_synced_at":"2025-04-30T22:51:03.733Z","repository":{"id":54195223,"uuid":"323401293","full_name":"aligator/GoFAT","owner":"aligator","description":"FAT filesystem implementation in pure Go compatible with afero.Fs and Go 1.16 fs.FS","archived":false,"fork":false,"pushed_at":"2021-03-23T12:01:53.000Z","size":282,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-25T22:38:52.241Z","etag":null,"topics":["afero","fat","fat32","filesystem","fs","go","golang","vfat"],"latest_commit_sha":null,"homepage":"","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/aligator.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}},"created_at":"2020-12-21T17:15:44.000Z","updated_at":"2024-10-11T13:10:16.000Z","dependencies_parsed_at":"2022-08-13T08:51:03.980Z","dependency_job_id":null,"html_url":"https://github.com/aligator/GoFAT","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligator%2FGoFAT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligator%2FGoFAT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligator%2FGoFAT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aligator%2FGoFAT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aligator","download_url":"https://codeload.github.com/aligator/GoFAT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251795387,"owners_count":21645019,"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":["afero","fat","fat32","filesystem","fs","go","golang","vfat"],"created_at":"2024-11-09T04:43:59.199Z","updated_at":"2025-04-30T22:51:03.711Z","avatar_url":"https://github.com/aligator.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/aligator/gofat/workflows/build/badge.svg)](https://github.com/aligator/gofat/actions) ![CodeQL](https://github.com/aligator/GoFAT/workflows/CodeQL/badge.svg) [![codecov](https://codecov.io/gh/aligator/GoFAT/branch/main/graph/badge.svg?token=EUUUT368Z0)](https://codecov.io/gh/aligator/GoFAT)\n# GoFAT\n\nA FAT filesystem implementation in pure Go.  \nIt implements the interface of [afero](https://github.com/spf13/afero).\n\n## Current Status\n\nReadonly File access works great. Write support is missing, yet.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"github.com/aligator/gofat\"\n\t\"github.com/spf13/afero\"\n)\n\nfunc main() {\n\t// Get any io.ReadSeeker implementation which provides a reader to a FAT32 filesystem.\n\t// You can use for example os.Open(...) to open an image file or even a `/dev/sdxy` device file from linux. \n\tvar reader io.ReadSeeker = ...\n\n\t// Then create a new GoFAT filesystem from the reader.\n\tfat, err := gofat.New(reader)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\t// Now you can access any method from the afero.Fs filesystem like for example afero.Walk.\n\t_ := afero.Walk(fat, \"/\", func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(path, info.IsDir())\n\t\treturn nil\n\t})\n\n\t// You can also access some FAT specific fields.\n\tfmt.Printf(\"Opened volume '%v' with type %v\\n\\n\", fat.Label(), fat.FSType())\n}\n```\n\nThat's it!\n\n## Compatibility with Go 1.16\n\nAs the Go 1.16 fs.FS interface is not fully compatible with the afero.Fs interface, it cannot be used with that directly.\nBut I added a simple wrapper around it.  \nYou can either just wrap an existing fat fs: \n```go\ngofs := GoFs{*fs}\n```\n\nOr directly create a new one using `NewGoFS(...)` or `NewGoFSSkipChecks(...)`.  \nNote that this wrapper has a small overhead, especially ReadDir because the result has to be converted to `[]fs.DirEntry`.\n\nI also added `testing.fstest` to the unit tests.\n\n## Test images\n\nTo get access to some test-images which already contain a FAT filesystem just run\n\n```bash\ngo generate\n```\n\nThis will extract the test images into `./testdata`.\n\n## Contribution\n\nContributions are welcome, just create issues or even better PRs. You may open a draft or issue first to discuss the\nchanges you would like to implement.\n\nYou may use github.com/cweill/gotests to generate your test boilerplate code.\n\nSome resources on how FAT works are:\n\n* https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system\n* https://wiki.osdev.org/FAT\n* https://github.com/ryansturmer/thinfat32\n* https://github.com/ryansturmer/thinfat32/blob/master/fatgen103.pdf\n\n## ToDo\n\n* more tests\n* implement some more attributes (e.g. hidden)\n* implement write support\n* support FAT12\n* check if compatibility with TinyGo for microcontrollers is possible. That would be a good use case for this lib...\n* use for a fuse filesystem driver\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligator%2Fgofat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faligator%2Fgofat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faligator%2Fgofat/lists"}