Site icon R-bloggers

Parsing multipart/form-data with webutils

[This article was first published on OpenCPU, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

To leave a comment for the author, please follow the link and comment on their blog: OpenCPU.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.