File-class: Class 'File'

Description Methods See Also Examples

Description

A Rook application that serves static files from a root directory, according to the path info of the Rook request.

Methods

new(root):

root is the name of the directory from where to serve files.

See Also

Rhttpd.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# This example serves all your files in /etc (on UNIX and Mac only).
#
# Note that when you open the application, you will see the word
# 'Forbidden'. "File" doesn't serve directories, so you must amend the
# url in the location bar with the file you want to view. Try adding /passwd.

s <- Rhttpd$new()
## Not run: 
s$start(quiet=TRUE)

## End(Not run)
s$add(name="etc",app=File$new('/etc'))
## Not run: 
s$browse('etc') # Opens a browser window to the app.

## End(Not run)
s$remove(all=TRUE)
rm(s)

jeffreyhorner/Rook documentation built on May 19, 2019, 4:01 a.m.