{"id":13776318,"url":"https://github.com/thibaultcha/lua-resty-multipart","last_synced_at":"2025-03-24T02:32:08.628Z","repository":{"id":152276839,"uuid":"71514327","full_name":"thibaultcha/lua-resty-multipart","owner":"thibaultcha","description":"Multipart parsing library for OpenResty","archived":false,"fork":false,"pushed_at":"2016-10-25T07:24:12.000Z","size":17,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T20:01:54.797Z","etag":null,"topics":["lua-resty","ngx-lua","openresty"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/thibaultcha.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}},"created_at":"2016-10-21T00:08:35.000Z","updated_at":"2022-07-22T12:39:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0e69852-38ed-43eb-938c-f84c4b92f84c","html_url":"https://github.com/thibaultcha/lua-resty-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/thibaultcha%2Flua-resty-multipart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaultcha%2Flua-resty-multipart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaultcha%2Flua-resty-multipart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibaultcha%2Flua-resty-multipart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thibaultcha","download_url":"https://codeload.github.com/thibaultcha/lua-resty-multipart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245198662,"owners_count":20576410,"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":["lua-resty","ngx-lua","openresty"],"created_at":"2024-08-03T18:00:22.777Z","updated_at":"2025-03-24T02:32:08.338Z","avatar_url":"https://github.com/thibaultcha.png","language":"Lua","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# lua-resty-multipart\n\n![Module Version][badge-version-image]\n[![Build Status][badge-travis-image]][badge-travis-url]\n\nmultipart/form-data MIME type parser optimized for\n[OpenResty](https://openresty.org) with JIT PCRE.\n\n**Note**: while this library is an improvement over some other ones out there,\nit is not implemented in a streaming fashion unlike, for instance,\n[lua-resty-upload](https://github.com/openresty/lua-resty-upload).\nThis means that your bodies must be accumulated in the Lua land, potentially\nexhausting the Lua VM memory. We shall provide a `resty.multipart.streaming`\nmodule for downstream/upstream streamed parsing.\n\n### Table of Contents\n\n* [Motivation](#motivation)\n* [Usage](#usage)\n* [Installation](#installation)\n* [Documentation](#documentation)\n* [License](#license)\n\n### Motivation\n\nTODO\n\n[Back to TOC](#table-of-contents)\n\n### Usage\n\nSimple encoder/decoder:\n```lua\nlocal multipart = require 'resty.multipart'\n\n-- decoding\nlocal res = assert(multipart.unserialize(body?, boundary?))\nfor i, part in ipairs(res) do\n  print(part.name)\nend\n\n-- encoding\nlocal body = assert(multipart.serialize({\n  {\n    name = 'part1',\n    headers = {['Content-Disposition'] = 'form-data; name=\"part1\"'},\n    value = 'hello world'\n  },\n  {\n    name = 'part2',\n    headers = {['Content-Disposition'] = 'form-data; name=\"part2\"'},\n    value = 'foo'\n  }\n}), '------boundary')\n```\n\nMultipart helper:\n```lua\nlocal multipart = require 'resty.multipart'\n\nlocal m = assert(multipart.new(body?, boundary?, content_type?))\n\n-- decoding\nlocal res = assert(m:decode())\n\n-- modifying\nassert(m:add('new_part', {['Content-Type'] = 'text/plain'}, 'hello world'))\nassert(m:remove('name'))\n\n-- encoding\nlocal new_body = assert(m:encode())\n```\n\n[Back to TOC](#table-of-contents)\n\n### Installation\n\nTODO\n\n[Back to TOC](#table-of-contents)\n\n### Documentation\n\nTODO\n\n[Back to TOC](#table-of-contents)\n\n### License\n\nWork licensed under the MIT License.\n\n[Back to TOC](#table-of-contents)\n\n[badge-travis-url]: https://travis-ci.org/thibaultcha/lua-resty-multipart\n[badge-travis-image]: https://travis-ci.org/thibaultcha/lua-resty-multipart.svg?branch=master\n\n[badge-version-image]: https://img.shields.io/badge/version-0.0.1-blue.svg?style=flat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthibaultcha%2Flua-resty-multipart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthibaultcha%2Flua-resty-multipart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthibaultcha%2Flua-resty-multipart/lists"}