# Working with non-tabular data

### **Load a single file**

```r
# See https://redivis.com/datasets/yz1s-d09009dbb/files for example data

t <- redivis$table("demo.example_data_files:yz1s:v1_3.example_file_types:4c10")

text_file <- t$file("pandas_core.py")
con <- text_file$open()
readLines(con)

binary_file <- t$file("bogota.tiff")
con <- binary_file$open("rb")
readBin(con)

file_contents <- text_file$read(as_text=TRUE) # Read all contents directly to memory

binary_file$download() # download to current working directory

# You can also use R's native open()
con <- open(redivis$table("table_ref")$file("filename"), "rb")
```

### Load all files in a table

```r
t <- redivis$table("Demo.example_data_files.example_file_types")

dir <- t.to_directory()
f <- dir.get("path/to/file.txt") # Will return None if doesn't exist
dir$download("/download/path") # Download all files to the provided path
dir$mount("/download/path")
# dir.mount() behaves the same as dir.download() was called (all files appear on disk)
# However, this doesn't actually download the files until they're needed, 
#    and as such is much faster, particularly when all files may not need to be read.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/api/client-libraries/redivis-r/examples/working-with-non-tabular-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
