Skip to content

Give httr::progress the ability to talk to shinyWidgets::progressBar.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

curso-r/shinyhttr

Repository files navigation

shinyhttr

Travis build status AppVeyor build status CRAN status CRAN downloads

The goal of shinyhttr is to integrate httr::progress with shinyWidgets::progressBar.

In practice, the difference will be

# from this
httr::GET("http://download.com/large_file.txt", 
          progress())


# to this
httr::GET("http://download.com/large_file.txt", 
          progress(session, id = "my_progress_bar1"))

gif_progress_example.gif

Installation

From CRAN:

install.packages("shinyhttr")

From github:

devtools::install_github("curso-r/shinyhttr")

Example

library(shiny)
library(shinyWidgets)
library(httr)
library(shinyhttr)

ui <- fluidPage(

  sidebarLayout(

    NULL,

    mainPanel(
      actionButton('download', 'Download 100MB file...'),
      tags$p("see R console to compare both progress bars."),
      progressBar(
        id = "pb",
        value = 0,
        title = "",
        display_pct = TRUE
      )
    )
  )
)

server <- function(input, output, session) {
  observeEvent(input$download, {
    GET(
      url = "https://speed.hetzner.de/100MB.bin",
      shinyhttr::progress(session, id = "pb") # <- the magic happens here. progress() now has session and id args
    )
  })
}

shinyApp(ui, server)

About

Give httr::progress the ability to talk to shinyWidgets::progressBar.

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages