# File$read

### Fil&#x65;**$**<mark style="color:purple;">**read**</mark>**(***\*, as\_text=False, start\_byte=0, end\_byte=NULL***)** → bytes | str

Reads the file contents into memory, either as raw bytes or as a string.

### **Parameters:**

**`as_text` :&#x20;*****bool, default False***\
Whether to read the file contents as a string. By default, the raw bytes of the file will be returned.

**`start_byte` :&#x20;*****int, default 0***\
The offset byte at which to start reading the file. Allows for reading part of a file. If not specified, the file will be read from the start.

**`end_byte` :&#x20;*****int, default NULL***\
The byte at which to stop reading the file, inclusive. Allows for reading part of a file. If not specified, the file will be read to the end.

### **Returns:**

**bytes | str**

### Examples

```r
t <- redivis$table("demo.example_data_files:yz1s:v1_3.example_file_types:4c10")
f <- t$file("pandas_core.py")

file_contents <- f$read(as_text=TRUE)
```
