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
Directory Methods
exists()
Checks if a directory exists.
boolean
true
if the directory exists, false
otherwise.
File
Type: Class extends FileSystemFile
File Properties
File Methods
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.
exists()
Checks if a file exists.
boolean
true
if the file exists, false
otherwise.
write(content)
Name | Type | Description |
---|---|---|
content | string | The content to write into the file. |
Writes content to the file.
void
FileSystem Next.write(file, contents)
Name | Type |
---|---|
file | File |
contents | string |
Promise<void>