{"id":22582941,"url":"https://github.com/coghost/pathlib","last_synced_at":"2025-03-28T16:45:09.402Z","repository":{"id":265363929,"uuid":"895848444","full_name":"coghost/pathlib","owner":"coghost","description":"Go package that provides an object-oriented interface for working with filesystem paths","archived":false,"fork":false,"pushed_at":"2024-11-29T03:31:12.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T17:28:50.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coghost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-29T03:19:22.000Z","updated_at":"2024-11-29T03:29:30.000Z","dependencies_parsed_at":"2024-11-29T09:32:54.950Z","dependency_job_id":null,"html_url":"https://github.com/coghost/pathlib","commit_stats":null,"previous_names":["coghost/pathlib"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coghost%2Fpathlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coghost%2Fpathlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coghost%2Fpathlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coghost%2Fpathlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coghost","download_url":"https://codeload.github.com/coghost/pathlib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068269,"owners_count":20718501,"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-12-08T06:13:02.523Z","updated_at":"2025-03-28T16:45:09.362Z","avatar_url":"https://github.com/coghost.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pathlib\n\n`pathlib` is a Go package that provides an object-oriented interface for working with filesystem paths. It's inspired by Python's `pathlib` module and aims to simplify file and directory operations in Go.\n\n## Features\n\n- Object-oriented path manipulation\n- Cross-platform path handling\n- Easy file and directory operations\n- Support for glob patterns\n- CSV and TSV file reading\n- Path expansion (environment variables and user home directories)\n\n## Installation\n\nTo install the `pathlib` package, use the following command:\n\n```bash\ngo get github.com/coghost/pathlib\n```\n\n## Usage\n\nHere are some examples of how to use the `pathlib` package:\n\n```go\nimport \"github.com/coghost/pathlib\"\n\n// Create a new path\np := pathlib.Path(\"/home/user/documents/file.txt\")\n\n// Get path components\nfmt.Println(p.Name)  // \"file.txt\"\nfmt.Println(p.Stem)  // \"file\"\nfmt.Println(p.Suffix)  // \".txt\"\n\n// Path operations\nparent := p.Parent()\nnewPath := p.WithName(\"newfile.txt\")\nrelativePath, _ := p.RelativeTo(\"/home/user\")\n\n// File operations\ncontent, _ := p.ReadText()\np.WriteText(\"Hello, World!\")\np.AppendText(\"\\nNew line\")\n\n// Directory operations\np.MkDirs()\nfiles, _ := p.ListFilesWithGlob(\"*.txt\")\n\n// CSV/TSV operations\ndata, _ := p.CSVGetSlices()\n```\n\n## Main Types and Functions\n\n- `FsPath`: The main type representing a file system path\n- `Path(string) *FsPath`: Create a new FsPath instance\n- `Home() (*FsPath, error)`: Get the user's home directory\n- `Cwd() (*FsPath, error)`: Get the current working directory\n- `Expand(string) string`: Expand environment variables and user home directory in a path\n\n## Contributing\n\nContributions to `pathlib` are welcome! Please submit issues and pull requests on GitHub.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoghost%2Fpathlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoghost%2Fpathlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoghost%2Fpathlib/lists"}