{"id":26820461,"url":"https://github.com/nmrshll/go-cp","last_synced_at":"2025-04-24T03:44:28.148Z","repository":{"id":57484278,"uuid":"86495839","full_name":"nmrshll/go-cp","owner":"nmrshll","description":"Golang library to make copying files easy","archived":false,"fork":false,"pushed_at":"2018-01-15T19:39:33.000Z","size":8,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T03:44:22.903Z","etag":null,"topics":["copy","file","go","golang","move"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/nmrshll/go-cp","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/nmrshll.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":"2017-03-28T18:52:42.000Z","updated_at":"2023-12-31T03:04:31.000Z","dependencies_parsed_at":"2022-09-02T19:50:20.869Z","dependency_job_id":null,"html_url":"https://github.com/nmrshll/go-cp","commit_stats":null,"previous_names":["n-marshall/go-cp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-cp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-cp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-cp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nmrshll%2Fgo-cp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nmrshll","download_url":"https://codeload.github.com/nmrshll/go-cp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250559522,"owners_count":21450167,"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":["copy","file","go","golang","move"],"created_at":"2025-03-30T06:32:33.509Z","updated_at":"2025-04-24T03:44:28.126Z","avatar_url":"https://github.com/nmrshll.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-cp\n### Golang library to make copying files easy\n\nCopying a file in vanilla Go forces you to deal with filesystem I/O, it's a bit overcomplicated for the general case, when you just want to copy a file as easy as using `cp $source $dest`.\nThis tiny, one-use-case library is just for that.\n\n# Installation\n\nRun `go get github.com/n-marshall/go-cp`.  \n\n### Try it\n\nIn the repo folder run `make example`.  \n\n# Usage\n\nSimply use `cp.Copy(sourceFile, destinationFile)`.  \nFull documentation found [here](https://godoc.org/github.com/nmrshll/go-cp)  \n\n## Example\n\n[embedmd]:# (./examples/example.go)\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\tcp \"github.com/nmrshll/go-cp\"\n)\n\nfunc main() {\n\terr := cp.CopyFile(\"examples/examplefile.ext\", \"examples/examplefile.copy.ext\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n## Usage details\n\n`CopyFile()` copies a file from src to dst. If src and dst files exist, and are\nthe same, then return success. Otherwise, attempt to create a hard link\nbetween the two files. If that fails, copy the file contents from src to dst.  \nCreates any missing directories.   \nSupports '~' notation for $HOME directory of the current user.\n\n`AbsolutePath()` converts a path (relative or absolute) into an absolute one.  \nSupports '~' notation for $HOME directory of the current user.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmrshll%2Fgo-cp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmrshll%2Fgo-cp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmrshll%2Fgo-cp/lists"}