在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Kong/lua-multipart开源软件地址(OpenSource Url):https://github.com/Kong/lua-multipart开源编程语言(OpenSource Language):Lua 100.0%开源软件介绍(OpenSource Introduction):lua-multipartA Lua library to parse and edit Usagelocal Multipart = require("multipart")
-- Initialize with a body
local multipart_data = Multipart(body, content_type_header)
-- Reading parameters
local parameter = multipart_data:get("param-name")
parameter.value -- The value
parameter.headers -- A table with the headers associated with the parameter
-- Reading all values of `files` part
local files = multipart_data:get_as_array("files")
-- Setting a new parameter
multipart_data:set_simple("some-param-name", "some-value")
-- Deleting a parameter
multipart_data:delete("param-name")
-- Setting a file
multipart_data:set_simple("name", "some-value", "filename", "content_type")
-- Get a multipart/form-data representation of the object
local body = multipart_data:tostring()
-- Get all the parameters in a Lua table, in the form of {param_name = param_value}
local t = multipart_data:get_all()
-- Get all the parameters in a Lua table, in the form of {param_name = param_value} where param_value is array
local t = multipart_data:get_all_as_arrays()
-- Get all the parameters in a Lua table, in the form of {param_name = param_value} where param_value is string or array
local t = multipart_data:get_all_with_arrays() ContributeThis library is a work in progress, pull-requests are welcomed. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论