RLesur / crrri

A Chrome Remote Interface written in R
https://rlesur.github.io/crrri/
Other
157 stars 12 forks source link

Write base64 wrapper #72

Closed cderv closed 5 years ago

cderv commented 5 years ago

This closes #22

I also updated the examples but not all the manual one. I think we should remove them BTW.

I choose to include .$data inside the function and not let the user provide the character. We could also the other way

async_save_as_pdf <- function(url) {
  function(client) {
    Page <- client$Page

    Page$enable() %...>% {
      Page$navigate(url = url)
      Page$loadEventFired()
    } %...>% {
      Page$printToPDF()
    } %...>% {
      write_base64(.$data, paste0(httr::parse_url(url)$hostname, ".pdf"))
    }
  }
}

Tell me if you prefer.


This change is Reviewable

cderv commented 5 years ago

Yes I see why. It would also make this function useful for other usecase. It would make sense to let the user precise the .$data. I don’t mind changing that if you prefer. It is ok with me.