R/httpget_file.R

Defines functions httpget_file

httpget_file <- function(fullpath){
  fullpath <- do.call("file.path", as.list(fullpath));
  res$checkfile(fullpath);

  #only GET/POST allowed
  res$checkmethod(c("GET", "POST"));
  
  switch(req$method(),
    "GET" = res$sendfile(fullpath),
    "POST" = execute_file(fullpath),
    stop("invalid method: ", req$method())
  );  
}

Try the opencpu package in your browser

Any scripts or data that you put into this service are public.

opencpu documentation built on Sept. 11, 2024, 6:31 p.m.