b7840dc16ff4cbbd15dd7383b9fcde0c59416606
[arvados.git] / sdk / R / man / ArvadosFile.Rd
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/ArvadosFile.R
3 \name{ArvadosFile}
4 \alias{ArvadosFile}
5 \title{ArvadosFile}
6 \description{
7 ArvadosFile class represents a file inside Arvados collection.
8 }
9 \section{Usage}{
10
11 \preformatted{file = ArvadosFile$new(name)}
12 }
13
14 \section{Arguments}{
15
16 \describe{
17   \item{name}{Name of the file.}
18 }
19 }
20
21 \section{Methods}{
22
23 \describe{
24   \item{getName()}{Returns name of the file.}
25   \item{getRelativePath()}{Returns file path relative to the root.}
26   \item{read(contentType = "raw", offset = 0, length = 0)}{Read file content.}
27   \item{write(content, contentType = "text/html")}{Write to file (override current content of the file).}
28   \item{connection(rw)}{Get connection opened in "read" or "write" mode.}
29   \item{flush()}{Write connections content to a file (override current content of the file).}
30   \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
31   \item{getSizeInBytes()}{Returns file size in bytes.}
32   \item{move(newLocation)}{Moves file to a new location inside collection.}
33 }
34 }
35
36 \examples{
37 \dontrun{
38 myFile <- ArvadosFile$new("myFile")
39
40 myFile$write("This is new file content")
41 fileContent <- myFile$read()
42 fileContent <- myFile$read("text")
43 fileContent <- myFile$read("raw", offset = 8, length = 4) 
44
45 #Write a table:
46 arvConnection <- myFile$connection("w")
47 write.table(mytable, arvConnection)
48 arvadosFile$flush()
49
50 #Read a table:
51 arvConnection <- myFile$connection("r")
52 mytable <- read.table(arvConnection)
53
54 myFile$move("newFolder/myFile")
55 }
56 }