18870: Need to declare NODES as array
[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(destination)}{Moves file to a new location inside collection.}
33   \item{copy(destination)}{Copies file to a new location inside collection.}
34 }
35 }
36
37 \examples{
38 \dontrun{
39 myFile <- ArvadosFile$new("myFile")
40
41 myFile$write("This is new file content")
42 fileContent <- myFile$read()
43 fileContent <- myFile$read("text")
44 fileContent <- myFile$read("raw", offset = 8, length = 4)
45
46 #Write a table:
47 arvConnection <- myFile$connection("w")
48 write.table(mytable, arvConnection)
49 arvadosFile$flush()
50
51 #Read a table:
52 arvConnection <- myFile$connection("r")
53 mytable <- read.table(arvConnection)
54
55 myFile$move("newFolder/myFile")
56 myFile$copy("newFolder/myFile")
57 }
58 }