shinyFiles/ 0000755 0001762 0000144 00000000000 13564471253 012401 5 ustar ligges users shinyFiles/NAMESPACE 0000644 0001762 0000144 00000001702 13564465100 013612 0 ustar ligges users # Generated by roxygen2: do not edit by hand
export(getVolumes)
export(parseDirPath)
export(parseFilePaths)
export(parseSavePath)
export(shinyDirButton)
export(shinyDirChoose)
export(shinyDirLink)
export(shinyFileChoose)
export(shinyFileSave)
export(shinyFilesButton)
export(shinyFilesExample)
export(shinyFilesLink)
export(shinySaveButton)
export(shinySaveLink)
importFrom(fs,dir_create)
importFrom(fs,dir_ls)
importFrom(fs,file_access)
importFrom(fs,file_exists)
importFrom(fs,file_info)
importFrom(fs,path)
importFrom(fs,path_ext)
importFrom(fs,path_file)
importFrom(htmltools,singleton)
importFrom(htmltools,tagList)
importFrom(htmltools,tags)
importFrom(jsonlite,toJSON)
importFrom(shiny,addResourcePath)
importFrom(shiny,invalidateLater)
importFrom(shiny,observe)
importFrom(shiny,observeEvent)
importFrom(shiny,req)
importFrom(shiny,restoreInput)
importFrom(shiny,runApp)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(tools,file_ext)
shinyFiles/README.md 0000644 0001762 0000144 00000004015 13350006203 013636 0 ustar ligges users # shinyFiles
[](https://travis-ci.org/thomasp85/shinyFiles) [](https://CRAN.R-project.org/package=shinyFiles) [](https://CRAN.R-project.org/package=shinyFiles)
This package extends the functionality of shiny by providing an API for client side access to the server file system. As many shiny apps are run locally this is equivalent to accessing the filesystem of the users own computer, without the overhead of copying files to temporary locations that is tied to the use of `fileInput()`.
The package can be installed from CRAN using `install.packages('shinyFiles')`.
Usage
----------
The package is designed to make it extremely easy to implement file system access. An example of implementing a file chooser would be:
In the ui.R file
```R
shinyUI(bootstrapPage(
shinyFilesButton('files', label='File select', title='Please select a file', multiple=FALSE)
))
```
In the server.R file
```R
shinyServer(function(input, output) {
shinyFileChoose(input, 'files', root=c(root='.'), filetypes=c('', 'txt'))
})
```
It is equally simple to implement directly in your custom html file as it only requires a single `` element. The equivalent of the above in raw html would be:
```html
File select
```
For an overview of all the different modules try the `shinyFilesExample()` function in the package. It gives an overview of all the necessary code, along with descriptions and working examples.
Credits
----------
* The file icons used in the file system navigator are taken from FatCows Farm-Fresh Web Icons (http://www.fatcow.com/free-icons)
* RStudio is a trademark of RStudio, Inc. File icons used by permission of RStudio, Inc.
shinyFiles/man/ 0000755 0001762 0000144 00000000000 13372250461 013145 5 ustar ligges users shinyFiles/man/shinyFiles-package.Rd 0000644 0001762 0000144 00000001747 13564456253 017165 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shinyFiles-package.R
\docType{package}
\name{shinyFiles-package}
\alias{shinyFiles}
\alias{shinyFiles-package}
\title{A Server-Side File System Viewer for Shiny}
\description{
\if{html}{\figure{logo.png}{options: align='right'}}
Provides functionality for client-side navigation of
the server side file system in shiny apps. In case the app is running
locally this gives the user direct access to the file system without the
need to "download" files to a temporary location. Both file and folder
selection as well as file saving is available.
}
\seealso{
Useful links:
\itemize{
\item \url{https://github.com/thomasp85/shinyFiles}
\item Report bugs at \url{https://github.com/thomasp85/shinyFiles/issues}
}
}
\author{
\strong{Maintainer}: Thomas Lin Pedersen \email{thomasp85@gmail.com} (0000-0002-5147-4711)
Authors:
\itemize{
\item Vincent Nijs
\item Thomas Schaffner
\item Eric Nantz
}
}
shinyFiles/man/shinyFiles-parsers.Rd 0000644 0001762 0000144 00000004411 13317420261 017222 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/filechoose.R, R/dirchoose.R, R/filesave.R
\name{shinyFiles-parsers}
\alias{shinyFiles-parsers}
\alias{parseFilePaths}
\alias{parseDirPath}
\alias{parseSavePath}
\title{Convert the output of a selection to platform specific path(s)}
\usage{
parseFilePaths(roots, selection)
parseDirPath(roots, selection)
parseSavePath(roots, selection)
}
\arguments{
\item{roots}{The path to the root as specified in the \code{shinyFileChoose()}
call in \code{shinyServer()}}
\item{selection}{The corresponding input variable to be parsed}
}
\value{
A data frame matching the format of \code{\link[shiny:fileInput]{shiny::fileInput()}}
}
\description{
This function takes the value of a shinyFiles button input variable and
converts it to be easier to work with on the server side. In the case of file
selections and saving the input variable is converted to a data frame (using
\code{parseFilePaths()} or \code{parseSavePath() respectively}) of the same
format as that provided by \code{\link[shiny:fileInput]{shiny::fileInput()}}. The only caveat
here is that the MIME type cannot be inferred in file selections so this will
always be an empty string and new files doesn't have a size so this is left
out with file saving. In the case of folder selection the input variable is
converted to a string (using \code{parseDirPath()}) giving the absolute path
to the selected folder.
}
\details{
The use of \code{parseFilePaths} makes it easy to substitute fileInput and
shinyFiles in your code as code that relies on the values of a file selection
doesn't have to change.
}
\examples{
\dontrun{
ui <- shinyUI(bootstrapPage(
shinyFilesButton('files', 'File select', 'Please select a file', FALSE),
verbatimTextOutput('rawInputValue'),
verbatimTextOutput('filepaths')
))
server <- shinyServer(function(input, output) {
roots = c(wd='.')
shinyFileChoose(input, 'files', roots=roots, filetypes=c('', 'txt'))
output$rawInputValue <- renderPrint({str(input$files)})
output$filepaths <- renderPrint({parseFilePaths(roots, input$files)})
})
runApp(list(
ui=ui,
server=server
))
}
}
\seealso{
Other shinyFiles: \code{\link{shinyFiles-buttons}},
\code{\link{shinyFiles-observers}},
\code{\link{shinyFilesExample}}
}
\concept{shinyFiles}
shinyFiles/man/shinyFiles-observers.Rd 0000644 0001762 0000144 00000011045 13317420261 017556 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/filechoose.R, R/dirchoose.R, R/filesave.R
\name{shinyFiles-observers}
\alias{shinyFiles-observers}
\alias{shinyFileChoose}
\alias{shinyDirChoose}
\alias{shinyFileSave}
\title{Create a connection to the server side filesystem}
\usage{
shinyFileChoose(input, id, updateFreq = 0, session = getSession(),
defaultRoot = NULL, defaultPath = "", ...)
shinyDirChoose(input, id, updateFreq = 0, session = getSession(),
defaultPath = "", defaultRoot = NULL, ...)
shinyFileSave(input, id, updateFreq = 0, session = getSession(),
defaultPath = "", defaultRoot = NULL, ...)
}
\arguments{
\item{input}{The input object of the \code{shinyServer()} call (usually
\code{input})}
\item{id}{The same ID as used in the matching call to
\code{shinyFilesButton} or as the id attribute of the button, in case of a
manually defined html. This id will also define the id of the file choice in
the input variable}
\item{updateFreq}{The time in milliseconds between file system lookups. This
determines the responsiveness to changes in the filesystem (e.g. addition of
files or drives). For the default value (0) changes in the filesystem are
shown only when a shinyFiles button is clicked again}
\item{session}{The session object of the shinyServer call (usually
\code{session}).}
\item{defaultRoot}{The default root to use. For instance if
\code{roots = c('wd' = '.', 'home', '/home')} then \code{defaultRoot}
can be either \code{'wd'} or \code{'home'}.}
\item{defaultPath}{The default relative path specified given the \code{defaultRoot}.}
\item{...}{Arguments to be passed on to \code{\link[=fileGetter]{fileGetter()}} or \code{\link[=dirGetter]{dirGetter()}}}
}
\value{
A reactive observer that takes care of the server side logic of the
filesystem connection.
}
\description{
These function sets up the required connection to the client in order for the
user to navigate the filesystem. For this to work a matching button should be
present in the html, either by using one of the button generating functions
or adding it manually. See \code{\link[=shinyFiles-buttons]{shinyFiles-buttons()}} for more details.
}
\details{
Restrictions on the access rights of the client can be given in several ways.
The root parameter specifies the starting position for the filesystem as
presented to the client. This means that the client can only navigate in
subdirectories of the root. Paths passed of to the \code{restrictions}
parameter will not show up in the client view, and it is impossible to
navigate into these subdirectories. The \code{filetypes} parameter takes a
vector of file extensions to filter the output on, so that the client is
only presented with these filetypes. The \code{hidden} parameter toggles
whether hidden files should be visible or not. Whenever a file or folder
choice is made the resulting files/folder will be accessible in the input
variable with the id given in the parameters. This value should probable be
run through a call to one of the parser (\code{\link[=shinyFiles-parsers]{shinyFiles-parsers()}}) in
order to get well formatted paths to work with.
}
\note{
The syntax for this version has changed with version 0.4.0. Prior to
that version the output of \code{shinyFileChoose()} should be assigned to the
output object. This is no longer the case and doing so will result in an
error. In newer versions the function returns an observer which can be
ignored for the most part, or assigned to a variable if there needs to be
interactions with it later on.
}
\examples{
\dontrun{
# File selections
ui <- shinyUI(bootstrapPage(
shinyFilesButton('files', 'File select', 'Please select a file', FALSE)
))
server <- shinyServer(function(input, output) {
shinyFileChoose(input, 'files', roots=c(wd='.'), filetypes=c('', 'txt'),
defaultPath='', defaultRoot='wd')
})
runApp(list(
ui=ui,
server=server
))
}
\dontrun{
# Folder selections
ui <- shinyUI(bootstrapPage(
shinyDirButton('folder', 'Folder select', 'Please select a folder', FALSE)
))
server <- shinyServer(function(input, output) {
shinyDirChoose(input, 'folder', roots=c(wd='.'), filetypes=c('', 'txt'))
})
runApp(list(
ui=ui,
server=server
))
}
\dontrun{
# File selections
ui <- shinyUI(bootstrapPage(
shinySaveButton('save', 'Save', 'Save as...')
))
server <- shinyServer(function(input, output) {
shinyFileSave(input, 'save', roots=c(wd='.'))
})
runApp(list(
ui=ui,
server=server
))
}
}
\seealso{
Other shinyFiles: \code{\link{shinyFiles-buttons}},
\code{\link{shinyFiles-parsers}},
\code{\link{shinyFilesExample}}
}
\concept{shinyFiles}
shinyFiles/man/traverseDirs.Rd 0000644 0001762 0000144 00000002270 13316373340 016112 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dirchoose.R
\name{traverseDirs}
\alias{traverseDirs}
\title{Traverse and update a tree representing the file system}
\usage{
traverseDirs(tree, root, restrictions, hidden)
}
\arguments{
\item{tree}{A list representing the tree structure of the file system to
traverse. Each element should at least contain the elements 'name' and
'expanded'. The elements 'empty' and 'children' will be created or updates if
they exist.}
\item{root}{A string with the location of the root folder for the tree}
\item{restrictions}{A vector of directories within the root that should be
filtered out of the results}
\item{hidden}{A logical value specifying whether hidden folders should be
returned or not}
}
\value{
A list of the same format as 'tree', but with updated values to
reflect the current file system state.
}
\description{
This function takes a tree representing a part of the file system and updates
it to reflect the current state of the file system as well as the settings
for each node. Children (contained folders) are recursed into if the parents
expanded element is set to TRUE, no matter if children are currently present.
}
shinyFiles/man/dirCreator.Rd 0000644 0001762 0000144 00000001671 13316373340 015537 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dirchoose.R
\name{dirCreator}
\alias{dirCreator}
\title{Create a function that creates a new directory}
\usage{
dirCreator(roots, ...)
}
\arguments{
\item{roots}{A named vector of absolute filepaths or a function returning a
named vector of absolute filepaths (the latter is useful if the volumes
should adapt to changes in the filesystem).}
\item{...}{Currently unused}
}
\value{
A function that creates directories based on the information returned
by the client.
}
\description{
This function returns a function that can be used to create new directories
based on the information returned from the client. The returned function
takes the name, path and root of the directory to create and parses it into
a platform compliant format and then uses dir.create to create it. The
returned function returns TRUE if the directory was created successfully and
FALSE otherwise.
}
shinyFiles/man/dirGetter.Rd 0000644 0001762 0000144 00000002723 13316373340 015371 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dirchoose.R
\name{dirGetter}
\alias{dirGetter}
\title{Create a function that updates a folder tree based on the given restrictions}
\usage{
dirGetter(roots, restrictions, filetypes, hidden = FALSE)
}
\arguments{
\item{roots}{A named vector of absolute filepaths or a function returning a
named vector of absolute filepaths (the latter is useful if the volumes
should adapt to changes in the filesystem).}
\item{restrictions}{A vector of directories within the root that should be
filtered out of the results}
\item{filetypes}{Currently unused}
\item{hidden}{A logical value specifying whether hidden files should be
returned or not}
}
\value{
A function taking a list representation of a folder hierarchy along
with the name of the root where it starts. See \code{\link[=traverseDirs]{traverseDirs()}} for
a description of the format for the list representation.
}
\description{
This functions returns a new function that will handle updating the folder
tree. It is the folder equivalent of \code{\link[=fileGetter]{fileGetter()}} but functions
slightly different as it needs to handle expanded branches of the folder
hierarchy rather than just the content of a single directory at a time. The
returned function takes a representation of a folder hierarchy along with the
root to where it belongs and updates the tree to correspond with the current
state of the file system, without altering expansions etc.
}
shinyFiles/man/shinyFilesExample.Rd 0000644 0001762 0000144 00000001536 13317420261 017066 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aaa.R
\name{shinyFilesExample}
\alias{shinyFilesExample}
\title{Run a simple example app using the shinyFiles functionality}
\usage{
shinyFilesExample()
}
\description{
When the function is invoked a shiny app is started showing a very simple
setup using shinyFiles. A button summons the dialog box allowing the user to
navigate the R installation directory. To showcase the restrictions parameter
the base package location has been hidden, and is thus inaccessible. A panel
besides the button shows how the user selection is made accessible to the
server after parsing with \code{\link[=parseFilePaths]{parseFilePaths()}}.
}
\seealso{
Other shinyFiles: \code{\link{shinyFiles-buttons}},
\code{\link{shinyFiles-observers}},
\code{\link{shinyFiles-parsers}}
}
\concept{shinyFiles}
shinyFiles/man/getVolumes.Rd 0000644 0001762 0000144 00000002347 13316373340 015574 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aaa.R
\name{getVolumes}
\alias{getVolumes}
\title{Get a list of available volumes}
\usage{
getVolumes(exclude)
}
\arguments{
\item{exclude}{A vector of volume names to be excluded from the return value}
}
\value{
A function returning a named vector of available volumes
}
\description{
This function is intended as an input to the roots parameter in
\code{\link[=fileGetter]{fileGetter()}} and \code{\link[=shinyFileChoose]{shinyFileChoose()}}. It returns a
function that returns a named vector of available volumes on the system. This
construction makes it dynamic so that a shinyFiles instance reflects new
volumes as they get added (e.g. usb drives). The function takes a single
argument giving names of volumes the developer wants removed from the return
value.
}
\details{
The function is OS specific and looks for volumes/drives in different places
depending on the system on which shiny is running.
\describe{
\item{Windows}{Returns all drives mapped to a letter}
\item{Mac OSX}{Looks in /Volumes/ and lists the directories therein}
\item{Linux}{Returns the system root}
}
If the function does not recognize the system under which it is running it
will throw an error
}
shinyFiles/man/figures/ 0000755 0001762 0000144 00000000000 13357451043 014613 5 ustar ligges users shinyFiles/man/figures/logo.png 0000644 0001762 0000144 00000012711 13316357415 016266 0 ustar ligges users PNG
IHDR iCCPsRGB IEC61966-2.1 (u+DQ?LfD4%6H(iڼyޛQLU/`"R&69Ϩ̹{>{9{.(#H48=3>E`,6NE{ƫVsA54*
/L7 |,,˩l%C4S8f}ܗԤVl%K2A7B~;j2,cH4¢.]a߾FOwz
5
\w}<{8˕{*zYB*AZT%<A4^B\g?BbEw]g pHYs IDATxixEߙIB!r+ \A@D<]Qt\]@S]EtEAՏGV]CXAC H:I \ߏL2 dP]]]U=bA h)jO@[a!(B#PF!@B"0Ea¸IҪ<]\$iD z˲'x?Oa$U1@G[2 i#I}X$!> 2GA:5?!!c'.
NriA]\رc1| 4i"'O qiM!8
TZADDD4k ~r^CHDU>jۿMGTPԨU*M&&c 0+JLe.'@{¨ g&hXXL_o
Ǚcgxbbb<]#2?e-v'$i5@<}ϝwT\ŋq[~>/MUR"h>'$iXmI I 렁;n#F`02o\z넱 2+H0.Ȑ!Cܹ}_rrK{5^obAйsQEȲ"In4e@7#F0dtx",Y
Ao JRY֯_ի\xyG< \,#Ɉ^e
S^GFuՒd._$$Z}ZVÔۦ$mWҽ߫b-ҪDJJJ8tPg̘3ZWF@TvzzZ)))!##TGffy]Hx3
߿?=ucJJJ̴q=0V*
BJ*++رbƍ
ٙ?<"UwW P5M|͜GpϽz, #Iڑ߀[u<)zߑׯ!cspbArOVKJK<˅$`/'Oŋ0`F4>okTQ3<44NI˝t 2a$IxEɣGaɒ$&&R5gy-z61=ZqfSfϞٳyta$IxzM`ٲe=YQjILfzzZ1LpAdݭ9A38MIv :Ԇۏg=IN-[0dȐFqL&3ϝdNǏ#++CG%,,Li9L>}i@6I҆KX)e>˴ikUUU|GJqm*ٳÆ
cIL:EWLW`Yte~H6X,^'nn`sϽ8,.]±Z[$qiΜ9g}gK/u$m`>{ 6<"<~YfF#oիWvn7;w?ݻ