{"id":18637570,"url":"https://github.com/dutchcoders/goftp","last_synced_at":"2025-04-05T04:14:47.806Z","repository":{"id":25208444,"uuid":"28632402","full_name":"dutchcoders/goftp","owner":"dutchcoders","description":"Golang FTP library with Walk support.","archived":false,"fork":false,"pushed_at":"2020-10-16T13:50:37.000Z","size":74,"stargazers_count":282,"open_issues_count":25,"forks_count":99,"subscribers_count":16,"default_branch":"v1","last_synced_at":"2025-03-29T03:11:41.983Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dutchcoders.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":"2014-12-30T13:48:39.000Z","updated_at":"2025-02-28T08:58:25.000Z","dependencies_parsed_at":"2022-08-23T21:10:59.646Z","dependency_job_id":null,"html_url":"https://github.com/dutchcoders/goftp","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/dutchcoders%2Fgoftp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fgoftp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fgoftp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fgoftp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dutchcoders","download_url":"https://codeload.github.com/dutchcoders/goftp/tar.gz/refs/heads/v1","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284954,"owners_count":20913704,"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-11-07T05:36:49.498Z","updated_at":"2025-04-05T04:14:47.780Z","avatar_url":"https://github.com/dutchcoders.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"goftp\n=====\n\nGolang FTP library with Walk support.\n\n## Features\n\n* AUTH TLS support\n* Walk \n\n## Sample\n```go\npackage main\n\nimport (\n    \"crypto/sha256\"\n    \"crypto/tls\"\n    \"fmt\"\n    \"io\"\n    \"os\"\n\n    \"encoding/hex\"\n    \"gopkg.in/dutchcoders/goftp.v1\"\n)\n\nfunc main() {\n    var err error\n    var ftp *goftp.FTP\n\n    // For debug messages: goftp.ConnectDbg(\"ftp.server.com:21\")\n    if ftp, err = goftp.Connect(\"ftp.server.com:21\"); err != nil {\n        panic(err)\n    }\n\n    defer ftp.Close()\n    fmt.Println(\"Successfully connected to\", server)\n\n    // TLS client authentication\n    config := tls.Config{\n        InsecureSkipVerify: true,\n        ClientAuth:         tls.RequestClientCert,\n    }\n\n    if err = ftp.AuthTLS(config); err != nil {\n        panic(err)\n    }\n\n    // Username / password authentication\n    if err = ftp.Login(\"username\", \"password\"); err != nil {\n        panic(err)\n    }\n\n    if err = ftp.Cwd(\"/\"); err != nil {\n        panic(err)\n    }\n\n    var curpath string\n    if curpath, err = ftp.Pwd(); err != nil {\n        panic(err)\n    }\n\n    fmt.Printf(\"Current path: %s\", curpath)\n\n    // Get directory listing\n    var files []string\n    if files, err = ftp.List(\"\"); err != nil {\n        panic(err)\n    }\n    fmt.Println(\"Directory listing:\", files)\n\n    // Upload a file\n    var file *os.File\n    if file, err = os.Open(\"/tmp/test.txt\"); err != nil {\n        panic(err)\n    }\n\n    if err := ftp.Stor(\"/test.txt\", file); err != nil {\n        panic(err)\n    }\n\n    // Download each file into local memory, and calculate it's sha256 hash\n    err = ftp.Walk(\"/\", func(path string, info os.FileMode, err error) error {\n        _, err = ftp.Retr(path, func(r io.Reader) error {\n            var hasher = sha256.New()\n            if _, err = io.Copy(hasher, r); err != nil {\n                return err\n            }\n\n            hash := fmt.Sprintf(\"%s %x\", path, hex.EncodeToString(hasher.Sum(nil)))\n            fmt.Println(hash)\n\n            return err\n        })\n\n        return nil\n    })\n}\n````\n\n## Contributions\n\nContributions are welcome.\n\n* Sourav Datta: for his work on the anonymous user login and multiline return status.\n* Vincenzo La Spesa: for his work on resolving login issues with specific ftp servers\n\n\n## Creators\n\n**Remco Verhoef**\n- \u003chttps://twitter.com/remco_verhoef\u003e\n- \u003chttps://twitter.com/dutchcoders\u003e\n\n## Copyright and license\n\nCode and documentation copyright 2011-2014 Remco Verhoef.\nCode released under [the MIT license](LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutchcoders%2Fgoftp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdutchcoders%2Fgoftp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutchcoders%2Fgoftp/lists"}