This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo Asset

A universal library that allows downloading assets and using them with other libraries.

Android
iOS
tvOS
Web
Included in Expo Go
Recommended version:
~56.0.25

expo-asset provides an interface to Expo's asset system. An asset is any file that lives alongside the source code of your app that the app needs at runtime. Examples include images, fonts, and sounds. Expo's asset system integrates with React Native's, so that you can refer to files with require('path/to/file'). This is how you refer to static image files in React Native for use in an Image component, for example. Check out React Native's documentation on static image resources for more information. This method of referring to static image resources works out of the box with Expo.

Installation

Terminal
- npx expo install expo-asset
- yarn expo install expo-asset
- pnpm expo install expo-asset
- bun expo install expo-asset

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-asset 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

app.json
{ "expo": { "plugins": [ [ "expo-asset", { "assets": ["path/to/file.png", "path/to/directory"] } ] ] } }

Configurable properties

NameDefaultDescription
assets[]

An array of asset files or directories to link to the native project. The paths should be relative to the project root so that the file names, whether specified directly or using a directory, will become the resource names.

Supported file types:

  • Images: .png, .jpg, .gif
  • Media: .mp4, .mp3, .lottie, .riv
  • SQLite database files: .db
  • 3D Models: .glb

Usage

Learn more about how to use the expo-asset config plugin to embed an asset file in your project in Load an asset at build time.

API

import { Asset } from 'expo-asset';

No API data file found, sorry!