{"id":13905951,"url":"https://github.com/mauri870/gcsfs","last_synced_at":"2025-04-13T09:31:30.901Z","repository":{"id":57562265,"uuid":"330292731","full_name":"mauri870/gcsfs","owner":"mauri870","description":"Golang io/fs implementation for Google Cloud Storage","archived":false,"fork":false,"pushed_at":"2024-01-20T03:50:35.000Z","size":157,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-07T23:46:18.716Z","etag":null,"topics":["gcs","golang","google-storage","iofs"],"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/mauri870.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":"2021-01-17T01:35:09.000Z","updated_at":"2024-04-07T13:32:38.000Z","dependencies_parsed_at":"2024-01-20T04:23:18.913Z","dependency_job_id":"226dc2b5-808a-46ca-8112-d355717e5d69","html_url":"https://github.com/mauri870/gcsfs","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/mauri870%2Fgcsfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauri870%2Fgcsfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauri870%2Fgcsfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauri870%2Fgcsfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauri870","download_url":"https://codeload.github.com/mauri870/gcsfs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223580077,"owners_count":17168562,"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":["gcs","golang","google-storage","iofs"],"created_at":"2024-08-06T23:01:26.892Z","updated_at":"2024-11-07T19:44:16.119Z","avatar_url":"https://github.com/mauri870.png","language":"Go","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# gcsfs - Google Cloud Storage for Go's io/fs\n\nThis package implements the io/fs interfaces for Google Cloud Storage buckets.\n\n## Notes\n\n- Go 1.16 is required since the io/fs package was introduced in this version.\n- io/fs only exposes read-only interfaces. By type asserting the return of Open to gcsfs.File you can use a Writer as expected.\n- Google Cloud Storage only emulates directories through a prefix, so when interacting with a dir you are indeed just using a prefix to objects.\n\n## Installation\n\n```bash\ngo get github.com/mauri870/gcsfs\n```\n\n## Usage\n\n```go\n// export GOOGLE_APPLICATION_CREDENTIALS with the path to a service account\ngfs := gcsfs.New(\"my-bucket)\n\n// or use the auxiliary NewWithClient / NewWithBucketHandle functions\n```\n\nTake a look at the io/fs docs to familiarize yourself with the methods, a quick intro:\n\n```go\n// import \"io/fs\"\n\n// Open a file\nfile, err := gfs.Open(\"path/to/object.txt\")\n\n// Type assertion to be able to use the File as a Writer\nfile, ok := file.(*gcsfs.File)\n\n// Stat\nfinfo, err := fs.Stat(gfs, \"path/to/object.txt\")\n\n// Read a file\ncontents, err := fs.ReadFile(gfs, \"path/to/object.txt\")\n\n// Read a directory\nfiles, err := fs.ReadDir(gfs, \".\")\n\n// Glob search\nmatches, err := fs.Glob(gfs, \"a/*\")\n\n// Walk directory tree\nerr := fs.WalkDir(gfs, \".\", func (path string, d fs.DirEntry, err error) error {\n\t// d.IsDir(), d.Info(), etc...\n})\n\n// Subtree rooted at dir\nsub, err := fs.Sub(gfs, \"b\")\n\n// http server serving the contents of the FS\nhttp.ListenAndServe(\":8080\", http.FileServer(http.FS(gfs)))\n\n// You can also create an FS that is bounded to a context, for example a timeout\ngfs = gfs.WithContext(ctx)\n```\n\n## Example command line tool\n\n```bash\ngo build ./cmd/gcsfs\n\nexport GOOGLE_APPLICATION_CREDENTIALS # path to a service account with bucket access\n# concatenate files\n./gcsfs cat -b bucket-name mydir/myfile.txt\n\n# serve files in a http webserver\n./gcsfs serve -b bucket-name -p 8081\n\n# show a tree view of files and dirs\n./gcsfs tree -b bucket-name .\n\n# list all files and dirs in a given directory\n./gcsfs ls -b bucket-name .\n```\n\n## Tests\n\n```bash\ngo test . -race -cover -count=1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauri870%2Fgcsfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauri870%2Fgcsfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauri870%2Fgcsfs/lists"}