{"id":22423431,"url":"https://github.com/prantlf/go-multipart-helpers","last_synced_at":"2025-08-24T21:18:15.755Z","repository":{"id":144226676,"uuid":"312600015","full_name":"prantlf/go-multipart-helpers","owner":"prantlf","description":"Helps writing file parts to MIME multipart messages while preserving the original content type inferred from the file extension.","archived":false,"fork":false,"pushed_at":"2022-01-29T13:50:57.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T10:43:05.482Z","etag":null,"topics":["form-data","go","go-module","go-package","helpers","multipart","multipart-formdata"],"latest_commit_sha":null,"homepage":"","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/prantlf.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-13T14:37:16.000Z","updated_at":"2023-03-19T18:46:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef51273e-2c7c-4cec-8e4c-f8aacd75778a","html_url":"https://github.com/prantlf/go-multipart-helpers","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgo-multipart-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgo-multipart-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgo-multipart-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Fgo-multipart-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prantlf","download_url":"https://codeload.github.com/prantlf/go-multipart-helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791899,"owners_count":20672668,"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":["form-data","go","go-module","go-package","helpers","multipart","multipart-formdata"],"created_at":"2024-12-05T18:11:18.537Z","updated_at":"2025-03-27T05:41:03.747Z","avatar_url":"https://github.com/prantlf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-multipart-helpers\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/prantlf/go-multipart-helpers)](https://pkg.go.dev/github.com/prantlf/go-multipart-helpers)\n[![Test Status](https://github.com/prantlf/go-multipart-helpers/workflows/Test/badge.svg)](https://github.com/prantlf/go-multipart-helpers/actions)\n[![codecov](https://codecov.io/gh/prantlf/go-multipart-helpers/branch/master/graph/badge.svg?token=XS0COPSRR7)](https://codecov.io/gh/prantlf/go-multipart-helpers)\n\nHelps writing file parts to MIME multipart messages according to [RFC7578] while preserving the original content type inferred from the file extension. See the [documentation] for more information.\n\n`CreateFormFile` from [multipart writer] sets the content type always to `application/octet-stream`. If you need to preserve the content type of the file decided by its file extension, choose a function among `CreateFilePart`,` WriteFile` or `WriteFileReader` from this package.\n\n## Installation\n\nAdd this package to `go.mod` and `go.sub` in your Go project:\n\n    go get github.com/prantlf/go-multipart-helpers\n\n## Usage\n\nUpload a file with comment:\n\n```go\nimport (\n  \"net/http\"\n  helpers \"github.com/prantlf/go-multipart-helpers\"\n)\n// compose a multipart form-data content\nmessage := \u0026bytes.Buffer{}\nwriter := multipart.NewWriter(message)\ncomp.AddField(\"comment\", \"a comment\")\nerr := helpers.WriteFile(writer, \"file\", \"test.txt\")\n// post a request with the generated content type and body\nresp, err := http.DefaultClient.Post(\"http://host.com/upload\",\n  writer.FormDataContentType(), message)\n```\n\nSee the [documentation] for the full interface.\n\n[documentation]: https://pkg.go.dev/github.com/prantlf/go-multipart-helpers\n[RFC7578]: https://tools.ietf.org/html/rfc7578\n[multipart writer]: https://golang.org/pkg/mime/multipart/#Writer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fgo-multipart-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprantlf%2Fgo-multipart-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Fgo-multipart-helpers/lists"}