{"id":15393881,"url":"https://github.com/mitchellh/go-fs","last_synced_at":"2025-04-05T20:07:08.913Z","repository":{"id":9243281,"uuid":"11063958","full_name":"mitchellh/go-fs","owner":"mitchellh","description":"Filesystem library for Go, implementing FAT filesystems so far.","archived":false,"fork":false,"pushed_at":"2018-05-08T16:18:24.000Z","size":58,"stargazers_count":89,"open_issues_count":3,"forks_count":19,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T19:05:26.266Z","etag":null,"topics":[],"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/mitchellh.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":"2013-06-30T03:22:42.000Z","updated_at":"2025-03-07T10:02:15.000Z","dependencies_parsed_at":"2022-08-18T15:23:58.068Z","dependency_job_id":null,"html_url":"https://github.com/mitchellh/go-fs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/go-fs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393569,"owners_count":20931812,"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":[],"created_at":"2024-10-01T15:20:39.677Z","updated_at":"2025-04-05T20:07:08.892Z","avatar_url":"https://github.com/mitchellh.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# FAT Filesystem Library for Go\n\nThis library implements the ability to create, read, and write\nFAT filesystems using pure Go.\n\n**WARNING:** While the implementation works (to some degree, see the\nlimitations section below), I highly recommend you **don't** use this\nlibrary, since it has many limitations and is generally a terrible\nimplementation of FAT. For educational purposes, however, this library\nmay be interesting.\n\nIn this library's current state, it is very good for _reading_ FAT\nfilesystems, and minimally useful for _creating_ FAT filesystems. See\nthe features and limitations below.\n\n## Features \u0026 Limitations\n\nFeatures:\n\n* Format a brand new FAT filesystem on a file backed device\n* Create files and directories\n* Traverse filesystem\n\nLimitations:\n\nThis library has several limitations. They're easily able to be overcome,\nbut because I didn't need them for my use case, I didn't bother:\n\n* Files/directories cannot be deleted or renamed.\n* Files never shrink in size.\n* Deleted file/directory entries are never reclaimed, so fragmentation\n  grows towards infinity. Eventually, your \"disk\" will become full even\n  if you just create and delete a single file.\n* There are some serious corruption possibilities in error cases. Cleanup\n  is not good.\n* Incomplete FAT32 implementation (although FAT12 and FAT16 are complete).\n\n## Usage\n\nHere is some example usage where an existing disk image is read and\na file is created in the root directory:\n\n```go\n// Assume this file was created already with a FAT filesystem\nf, err := os.OpenFile(\"FLOPPY.dmg\", os.O_RDWR|os.O_CREATE, 0666)\nif err != nil {\n\tpanic(err)\n}\ndefer f.Close()\n\n// BlockDevice backed by a file\ndevice, err := fs.NewFileDisk(f)\nif err != nil {\n\tpanic(err)\n}\n\nfilesys, err := fat.New(device)\nif err != nil {\n\tpanic(err)\n}\n\nrootDir, err := filesys.RootDir()\nif err != nil {\n\tpanic(err)\n}\n\nsubEntry, err := rootDir.AddFile(\"HELLO_WORLD\")\nif err != nil {\n\tpanic(err)\n}\n\nfile, err := subEntry.File()\nif err != nil {\n\tpanic(err)\n}\n\n_, err = io.WriteString(file, \"I am the contents of this file.\")\nif err != nil {\n\tpanic(err)\n}\n```\n\n## Thanks\n\nThanks to the following resources which helped in the creation of this\nlibrary:\n\n* [fat32-lib](https://code.google.com/p/fat32-lib/)\n* [File Allocation Table on Wikipedia](http://en.wikipedia.org/wiki/File_Allocation_Table)\n* Microsoft FAT filesystem specification\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fgo-fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fgo-fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fgo-fs/lists"}