{"id":22736577,"url":"https://github.com/fredwangwang/formcontent","last_synced_at":"2025-03-30T02:44:09.095Z","repository":{"id":57605179,"uuid":"138958144","full_name":"fredwangwang/formcontent","owner":"fredwangwang","description":null,"archived":false,"fork":false,"pushed_at":"2018-08-16T14:19:13.000Z","size":14,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T05:22:52.357Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fredwangwang.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":"2018-06-28T02:50:30.000Z","updated_at":"2018-08-16T14:18:50.000Z","dependencies_parsed_at":"2022-08-27T22:03:46.519Z","dependency_job_id":null,"html_url":"https://github.com/fredwangwang/formcontent","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/fredwangwang%2Fformcontent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwangwang%2Fformcontent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwangwang%2Fformcontent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredwangwang%2Fformcontent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredwangwang","download_url":"https://codeload.github.com/fredwangwang/formcontent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246269911,"owners_count":20750319,"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-10T21:27:48.263Z","updated_at":"2025-03-30T02:44:09.071Z","avatar_url":"https://github.com/fredwangwang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"This helper library allows you upload large file without loading the file content into the memory.\n\n[![Build Status](https://travis-ci.org/fredwangwang/formcontent.svg?branch=master)](https://travis-ci.org/fredwangwang/formcontent)\n\n[example](https://gist.github.com/fredwangwang/8c86a34da27c2bc9ded3a38968576e4a):\n```go\npackage main\n\nimport (\n\t\"github.com/fredwangwang/formcontent\"\n\t\"net/http\"\n\t\"log\"\n\t\"io/ioutil\"\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar err error\n\n\tclient := \u0026http.Client{}\n\n\turi := \"https://full.qualified.domain.name/post/route\"\n\n\t// initialize multipart form\n\tmultipart := formcontent.NewForm()\n\n\t// add fields to the form\n\tif err = multipart.AddFile(\"file\", \"/path/to/the/file.ext\"); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err = multipart.AddField(\"attribute1\", \"value1\"); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err = multipart.AddField(\"attribute2\", \"value2\"); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// finish editing the form\n\tform := multipart.Finalize()\n\n\t// create a request\n\treq, err := http.NewRequest(\"POST\", uri, form.Content)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treq.Header.Set(\"Content-Type\", form.ContentType)\n\treq.ContentLength = form.ContentLength\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer resp.Body.Close()\n\trespContent, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(resp.StatusCode)\n\tfmt.Println(resp.Header)\n\tfmt.Println(string(respContent))\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredwangwang%2Fformcontent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredwangwang%2Fformcontent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredwangwang%2Fformcontent/lists"}