This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo FileSystem
A library that provides access to the local file system on the device.
expo-file-system provides access to files and directories stored on a device or bundled as assets into the native project. It also allows downloading files from the network.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Configuration in app config
You can configure expo-file-system using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.
Example app.json with config plugin
Configurable properties
Are you using this library in an existing React Native app?
If you're not using Continuous Native Generation (CNG) or you're using native ios project manually, then you need to add the LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled keys to your project's ios/[app]/Info.plist:
<key>LSSupportsOpeningDocumentsInPlace</key> <true/> <key>UIFileSharingEnabled</key> <true/>
Usage
import { File, Directory, Paths } from 'expo-file-system';
The File and Directory instances hold a reference to a file, content, or asset URI.
The file or directory does not need to exist — an error will be thrown from the constructor only if the wrong class is used to represent an existing path (so if you try to create a File instance passing a path to an already existing directory).
Features
- Both synchronous and asynchronous, read and write access to file contents
- Creation, modification and deletion
- Available properties, such as
type,size,creationDate, and more - Ability to read and write files as streams or using the
FileHandleclass - Easy file download/upload using
downloadFileAsyncorexpo/fetch
Examples
Picking files using system pickers
Usage with expo-document-picker:
Using the built-in pickFileAsync or pickDirectoryAsync method on Android:
Uploading files using expo/fetch
You can upload files as blobs directly with fetch built into the Expo package:
Or using the FormData constructor:
API
No API data file found, sorry!