{"id":16828623,"url":"https://github.com/gowebprod/multipart","last_synced_at":"2025-10-21T06:44:40.823Z","repository":{"id":44939168,"uuid":"446558128","full_name":"GoWebProd/multipart","owner":"GoWebProd","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-17T11:00:02.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T07:42:07.905Z","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/GoWebProd.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":"2022-01-10T19:37:09.000Z","updated_at":"2022-01-12T12:41:00.000Z","dependencies_parsed_at":"2022-09-08T15:12:05.372Z","dependency_job_id":null,"html_url":"https://github.com/GoWebProd/multipart","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/GoWebProd%2Fmultipart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoWebProd%2Fmultipart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoWebProd%2Fmultipart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoWebProd%2Fmultipart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoWebProd","download_url":"https://codeload.github.com/GoWebProd/multipart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244110034,"owners_count":20399561,"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-10-13T11:27:37.543Z","updated_at":"2025-10-21T06:44:35.777Z","avatar_url":"https://github.com/GoWebProd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# multipart\n\nMade on the basis of mime/multipart\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/GoWebProd/multipart\"\n\t\"github.com/pkg/errors\"\n)\n\nfunc main() {\n\tfileReq, err := http.NewRequestWithContext(context.Background(), http.MethodGet, \"http://localhost/testfile\", nil)\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"Can't create new request\"))\n\t}\n\n\thttpClient := \u0026http.Client{\n\t\tTimeout: 5 * time.Second,\n\t}\n\n\tfileResp, err := httpClient.Do(fileReq)\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"Can't file request\"))\n\t}\n\n\tdefer fileResp.Body.Close()\n\n\twriter := multipart.NewWriter()\n\n\terr = writer.CreateFormFileReader(\"content\", \"very_important_file_name\", multipart.NewReader(fileResp.Body, int(fileResp.ContentLength)))\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"Can't create file form\"))\n\t}\n\n\terr = writer.CreateFormField(\"objectType\", []byte(\"file\"))\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"Can't write object type field\"))\n\t}\n\t\n\tdefer writer.Close()\n\n\treq, err := http.NewRequestWithContext(context.Background(), http.MethodPost, \"http://localhost/checkfile\", writer)\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"Can't create object scan request\"))\n\t}\n\n\treq.ContentLength = int64(writer.Len())\n\t\n\treq.Header.Add(\"Content-Type\", writer.FormDataContentType())\n\n\tresp, err := httpClient.Do(req)\n\tif err != nil {\n\t\tpanic(errors.Wrap(err, \"Can't do object scan request\"))\n\t}\n\n\tdefer resp.Body.Close()\n}\n\n```\n\n## Benchmark\n\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/GoWebProd/multipart\nBenchmarkStd-16           465567              2602 ns/op            1345 B/op         37 allocs/op\nBenchmarkThis-16         1557962               755 ns/op             275 B/op          7 allocs/op\nPASS\nok      github.com/GoWebProd/multipart  4.510s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgowebprod%2Fmultipart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgowebprod%2Fmultipart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgowebprod%2Fmultipart/lists"}