Parsing multipart/form-data with webutils
November 1, 2014
As part of a larger effort to clean up and rewrite the opencpu package, some of the more general utilities will be moved into a new, separate package called webutils. The first release of webutils is now on CRAN.
The package contains a simple http request body parser that supports application/x-www-form-urlencoded
, multipart/form-data
, and application/json
. The multipart parser is written in pure R but surprisingly fast. Furthermore, two demo functions are included that illustrate how to host and parse simple HTML forms (with file uploads) using either rhttpd or httpuv.
library(webutils)
demo_rhttpd()
demo_httpuv()
Nothing ground breaking in a time of interactive graphics and restful data science as a service, but sometimes all you need is a simple form. I had a hard time finding a decent multipart parser for R, and this one does the job quite nicely.