% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/decode-shinylive-link.R
\name{decode_shinylive_link}
\alias{decode_shinylive_link}
\title{Decode Shinylive link(s) to extract files to local directory}
\usage{
decode_shinylive_link(
  url,
  output_dir = file.path(tempdir(), "shinylive_files"),
  overwrite = FALSE,
  create_subdir = TRUE,
  name_dirs = TRUE
)
}
\arguments{
\item{url}{Character string or vector containing Shinylive URL(s)}

\item{output_dir}{Character string specifying the output directory path.
Defaults to a \code{shinylive_files} directory inside the session temporary
directory; pass an explicit path to extract somewhere permanent.}

\item{overwrite}{Logical. Whether to overwrite existing files (default: FALSE)}

\item{create_subdir}{Logical. If \code{TRUE} (default), each decoded link is
extracted into its own subdirectory under \code{output_dir} rather than directly
into it. For a single URL the subdirectory is named \verb{shinylive_<hash>}, where
\verb{<hash>} is a short fingerprint of the URL. For multiple URLs, see
\code{name_dirs}. Set \code{FALSE} to extract straight into \code{output_dir}; with multiple
URLs this means identically named files (such as \code{app.R}) collide, so a later
app overwrites an earlier one when \code{overwrite = TRUE}, or is skipped when
\code{overwrite = FALSE}.}

\item{name_dirs}{Logical. For multiple URLs, controls how the per-link
subdirectories are named: \code{TRUE} (default) numbers them \code{app_01}, \code{app_02},
...; \code{FALSE} names each one \verb{shinylive_<hash>} from the URL fingerprint.
Ignored for a single URL, and ignored when \code{create_subdir = FALSE}.}
}
\value{
For a single URL, a \code{shinylive_decoded} object. For multiple URLs, a
\code{shinylive_decoded_batch} object.
}
\description{
Decodes Shinylive sharelinks to extract the embedded files and save them
to a local directory. This is the reverse operation of creating Shinylive links.
Handles both single URLs and multiple URLs automatically.
}
\examples{
# Round-trip: build a link, then decode it back to files
url <- as.character(shinylive_r_link("library(shiny)"))

result <- decode_shinylive_link(url)
print(result)

# Extract to a directory of your choosing
out <- file.path(tempdir(), "my_app")
decode_shinylive_link(url, output_dir = out, create_subdir = FALSE, overwrite = TRUE)
list.files(out)

# Both engines at once
urls <- c(url, as.character(shinylive_py_link("from shiny import App")))
decode_shinylive_link(urls, output_dir = file.path(tempdir(), "my_apps"))

}
\seealso{
\code{\link[=preview_shinylive_link]{preview_shinylive_link()}} to inspect a link without writing files;
\code{\link[=shinylive_r_link]{shinylive_r_link()}} and \code{\link[=shinylive_py_link]{shinylive_py_link()}} to create links.
}
