This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 51).
A library that provides access to the local file system on the device.
GitHub
npm
expo-file-system
provides access to a file system stored locally on the device.
-Â
npx expo install expo-file-system
If you are installing this in an existing React Native app (bare workflow), start by installing expo
in your project. Then, follow the additional instructions as mentioned by library's README under "Installation in bare React Native projects" section.
Directory
Type: Class extends FileSystemDirectory
Directory Properties
exists
Type: boolean
A boolean representing if a directory exists. true
if the directory exists, false
otherwise.
Directory Methods
File
Type: Class extends FileSystemFile
File Properties
exists
Type: boolean
A boolean representing if a file exists. true
if the file exists, false
otherwise.
md5
Type: null | string
An md5 hash of the file. Null if the file does not exist or it cannot be read.
size
Type: null | number
A size of the file in bytes. Null if the file does not exist or it cannot be read.
File Methods
base64()
Retrieves content of the file as base64.
string
The contents of the file as a base64 string.
downloadFileAsync(url, destination)
Name | Type | Description |
---|---|---|
url | string | The URL of the file to download. |
destination | Directory | File | The destination directory or file. If a destination is provided, the resulting filename will be determined based on the response headers. |
Downloads a file from the network.
A promise that resolves to the downloaded file.
write(content)
Name | Type | Description |
---|---|---|
content | string | The content to write into the file. |
Writes content to the file.
void
Paths
Paths Methods
parse(path)
Name | Type |
---|---|
path | string |
{
base: string,
dir: string,
ext: string,
name: string,
root: string
}