{"id":26136071,"url":"https://github.com/breakroom/multipart","last_synced_at":"2025-06-10T08:04:30.559Z","repository":{"id":42464479,"uuid":"359406408","full_name":"breakroom/multipart","owner":"breakroom","description":"Constructs a multipart message, such an HTTP form data request or multipart email","archived":false,"fork":false,"pushed_at":"2024-07-05T07:09:01.000Z","size":27,"stargazers_count":52,"open_issues_count":7,"forks_count":13,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-10T08:04:11.785Z","etag":null,"topics":["elixir","http","multipart","rfc-2046","rfc-7578"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/breakroom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2021-04-19T09:44:19.000Z","updated_at":"2025-02-13T10:13:23.000Z","dependencies_parsed_at":"2025-05-20T01:08:17.249Z","dependency_job_id":"a69fcdaa-a94c-45d7-bf5a-03f074b0b6b3","html_url":"https://github.com/breakroom/multipart","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakroom%2Fmultipart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakroom%2Fmultipart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakroom%2Fmultipart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakroom%2Fmultipart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/breakroom","download_url":"https://codeload.github.com/breakroom/multipart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/breakroom%2Fmultipart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259033829,"owners_count":22795769,"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":["elixir","http","multipart","rfc-2046","rfc-7578"],"created_at":"2025-03-11T00:06:49.810Z","updated_at":"2025-06-10T08:04:30.534Z","avatar_url":"https://github.com/breakroom.png","language":"Elixir","readme":"# Multipart\n\n[![Hex pm](http://img.shields.io/hexpm/v/multipart.svg?style=flat)](https://hex.pm/packages/multipart)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/multipart/)\n\nConstructs a multipart message, such an HTTP form data request or multipart email.\n\n# Features\n\n- Follows RFC 2046 and RFC 7578\n- Can stream the request body, reducing memory consumption for large request bodies\n\n# Requirements\n\n- Elixir \u003e= 1.10\n- Erlang/OTP \u003e= 21\n\n## Installation\n\nAdd `multipart` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:multipart, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\nTypically, you'll use `Multipart` to construct the HTTP body and headers, and use those to build a request in an HTTP client such as [Finch](https://github.com/keathley/finch):\n\n```elixir\nmultipart =\n  Multipart.new()\n  |\u003e Multipart.add_part(Part.binary_body(\"first body\"))\n  |\u003e Multipart.add_part(Part.binary_body(\"second body\", [{\"content-type\", \"text/plain\"}]))\n  |\u003e Multipart.add_part(Part.binary_body(\"\u003cp\u003ethird body\u003c/p\u003e\", [{\"content-type\", \"text/html\"}]))\n\nbody_stream = Multipart.body_stream(multipart)\ncontent_length = Multipart.content_length(multipart)\ncontent_type = Multipart.content_type(multipart, \"multipart/mixed\")\n\nheaders = [{\"Content-Type\", content_type}, {\"Content-Length\", to_string(content_length)}]\n\nFinch.build(\"POST\", \"https://example.org/\", headers, {:stream, body_stream})\n|\u003e Finch.request(MyFinch)\n```\n\nYou can construct a `multipart/form-data` request using the field helpers in `Path`.\n\n```elixir\nmultipart =\n  Multipart.new()\n  |\u003e Multipart.add_part(Part.text_field(\"field 1 text\", :field1))\n  |\u003e Multipart.add_part(Part.file_field(\"/tmp/upload.jpg\", :image))\n\nbody_stream = Multipart.body_stream(multipart)\ncontent_length = Multipart.content_length(multipart)\ncontent_type = Multipart.content_type(multipart, \"multipart/form-data\")\n\nheaders = [{\"Content-Type\", content_type}, {\"Content-Length\", to_string(content_length)}]\n\nFinch.build(\"POST\", \"https://example.org/\", headers, {:stream, body_stream})\n|\u003e Finch.request(MyFinch)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreakroom%2Fmultipart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbreakroom%2Fmultipart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreakroom%2Fmultipart/lists"}